There are a lot of things easy to do in print that web designers struggle to emulate when they take print designs to the web. One of those challenges is centering text on the longest line.
Clagnut takes on “centering text on the longest line” to show you how to make this almost impossible task possible with CSS.
The Web Typography project continues to proceed, albeit at a glacial pace. One of the reasons for the slow progress is guidelines such as this: “to distinguish verse quotations from surrounding prose, they should be […] centered on the longest line.”
An uncommon request, but it sounds straightforward enough. Don’t let that fool you. Centering a block is reasonably simple if you know how wide it is…But if you don’t know how wide your block – perhaps you’re drawing text from a CMS – then things get tricky.
The solution isn’t as easy as it sounds, and even Clagnut found this was more complicated than originally posted. To make this happen, you need a different solution for different browsers. So the browser-specific battle with CSS development continues.
Have you found a better solution?
Site Search Tags: css, web page design, web design tips, web design help, centering on the longest line, centering, centering text, centering text with css, align text, css align, web page design css
Copyright Lorelle VanFossen, member of the 9Rules Network Subscribe
2 Comments
Tangent
I know it’s not an option, but I enjoyed this post on the business case for forcing your customers to only use one web browser.
It isn’t realistic when your customers are “the public” but it’s something to remember when developing in-house applications — if you can standardize on one browser for internal corporate applications then it’s a good idea to do so.
Clagnut writes a beautiful English too 😉
I noticed that he uses “estimable” about some Steve.
Isn’t that fairly unusual?
Elegant or eloquent, is that what you’d call it ?
As you know, I’m a little bit Swedish, so I can’t help it.
3 Trackbacks/Pingbacks
[…] The Battle Over Centering on the Longest Line in CSS […]
[…] The Battle Over Centering on the Longest Line in CSS […]
[…] The Battle Over Centering on the Longest Line in CSS […]