Forum Moderators: not2easy

Message Too Old, No Replies

Text-align:justify problem

Text aligns but word spacing doubles

         

MarkAD

9:43 am on Oct 5, 2007 (gmt 0)

10+ Year Member



Hi,

I'm using text-align:justify; to justify some text in a table (its for a HTML newletter hence the reason I'm using tables). The problem is the text justifys but the word spacing doubles, I tried using word-spacing:normal but it doesn't seem to effect the text in any way.

Anybody any ideas how to solve this?

Thanks for your help, cheers.

penders

10:20 am on Oct 5, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The problem is the text justifys but the word spacing doubles,...

Setting text-align:justify makes the text fill the full width by increasing the word-spacing on each line box. (I therefore don't think that manually setting the word-spacing would have any effect.) However, I don't think UAs adjust the letter-spacing as well, as perhaps a typesetter would? You could try increasing the letter-spacing, but this will effect the entire element, not just the line box.

Or are you suggesting that you think another word should fit on the line instead of increasing the spacing between the words?

MarkAD

12:14 pm on Oct 5, 2007 (gmt 0)

10+ Year Member



I see, tricky problem. But yes I think more words should fit on particular lines. Is there any way around this?

Thanks.

penders

1:07 pm on Oct 5, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



But yes I think more words should fit on particular lines.

You should have the same number of words on a line as if you had text-align:left and assuming you have no erroneous spaces/carriage returns in your source then it should be fitting as best it can. However, it will only take an extra 1px for it to spill onto more lines.

Do you have padding on your container? This may be giving the impression that there is more room than there actually is.

There are different sized spaces available in HTML. I thought there was a 'short space', but the only two I can lay my hands on at the mo are $ensp; and $emsp; (effectively 'normal' and 'double' spaced respt). You could try substituting 'normal' spaces for something shorter?! But it seems like a lot of hassle and I really don't know how well these are supported and whether the idea would even work in principle!?