Jump to content

Centering the final line of a justified text block


Recommended Posts

I don't think this is necessarily a JavaScript question, but it seemed a good place to get answers. I have a problem posed to me by our design team that they've been unable to overcome. They have a block of text that needs to be fully justified in the text box, but whatever is left on the final line needs to be centered. Applying justification by itself causes the final line to be left-aligned. I've tried several combinations of the <span> and <p> tags to no avail. I can get the final line centered, but even when it's wrapped in a <span> tag it forces all of the preceding text to be centered instead of fully justified. Of course, this was done on static text, which the final product will not have, making the issue even more complex. Any ideas?
Link to comment
Share on other sites

So, I have solved my own issue by doing something that I didn't think would actually work. It seems the quad attribute of the <p> tag can actually have more than one value, so starting my text with <p br="false" quad="JC"> actually ends up both centering AND justifying. Interestingly, quad="CJ" does not work. Edited by tobarstep
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...