WarKirby Posted November 4, 2010 Share Posted November 4, 2010 Hello folks. We have a problem. We have three linex of text. They have to remain three distinct lines. However, we want to justify them all, eg, make them all the same length. The lines are somewhat different lengths so this would of course involve adjusting spacing, as the justify property usually does. The problem is that align="justify" only seems to work for a contigious block of wrapped text. Linebreaks mess it up. To put it another way, we have: blah1 blah1 blah1 blah1 blah2 blah2 blah2 blah2 blah2 blah2 blah3 blah3 blah3 blah3 blah3 And we want it to look something like: blah1 blah1 blah1 blah1 blah2 blah2 blah2 blah2 blah2 blah2 blah3 blah3 blah3 blah3 blah3 Noting that the content on each line must remain distinct and unchanged, just the spacing of it. Is it possible to do this, other than manually adding spaces (which is really messy). Ideally avoiding tables too Quote Link to comment https://forums.phpfreaks.com/topic/217736-justifying-multiple-lines-of-text/ Share on other sites More sharing options...
nano Posted November 4, 2010 Share Posted November 4, 2010 Stay away from line breaks - I am not even sure they are semantic? Wrap each line in its own <p></p> to represent a paragraph. As this is a block level element, it will push them onto new respective lines. Then in you css just have: text-align:justify; You could give each paragraph a fixed width to achieve what you want, or put them inside a wrapper with a fixed width. Good luck Quote Link to comment https://forums.phpfreaks.com/topic/217736-justifying-multiple-lines-of-text/#findComment-1130233 Share on other sites More sharing options...
haku Posted November 8, 2010 Share Posted November 8, 2010 Agreed. Quote Link to comment https://forums.phpfreaks.com/topic/217736-justifying-multiple-lines-of-text/#findComment-1131614 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.