简体   繁体   中英

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

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 .

Could you not use CSS for this? All those non-breaking spaces are scary looking!

<TD ALIGN="left" WIDTH="20%" style="text-align: justify">#PrimaryKeyValues#</TD>

http://www.w3schools.com/cssref/pr_text_text-align.asp

Or, if you just want it indenting:

<TD ALIGN="left" WIDTH="20%" style="text-indent: 20px">#PrimaryKeyValues#</TD>

Does that help?

Thanks, Michael.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM