Search code examples
htmltextformattingalignment

Justify wrapped text in html


I am trying to do a left justify on a field by using:

 <TD ALIGN="left" WIDTH="20%" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#PrimaryKeyValues#</TD>    </div>

But, when the text is too large, it gets wrapped around, and the wrapped text doesn't begin at the same position.

    PRODUCT_ID:1(Indirect Auto Retail),PREVIOUSLY_LOGGED_FLG:1,
EVALUATOR_ID:65(Product Test),DECISION_ID:1(APPCOND)
    PRODUCT_ID:1(Indirect Auto Retail),PREVIOUSLY_LOGGED_FLG:1,
EVALUATOR_ID:65(Product Test),DECISION_ID:1(APPCOND)
    USER_ID:PTKIM  
    USER_ID:PTKIM 

Hope the above text sample shows what is happening


Solution

  • Never, ever, "justify" text using (non breaking or other) spaces. Just use CSS properties for text-align, text-wrap etc. For more information check out CSS Text.