Jump to content

Justifying Multiple Lines of Text


WarKirby

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.