Blah blah

What I want from CSS 3, part 1

Monday 19 December 2005

Andy Budd recently posted that he wants min-padding, max-padding, min-margin and max-margin in CSS 3. My wishes are much more modest.

I want the ability to display poetry correctly on the Web.
I know I bang on about computer code and stuff like that, but my degree was English Literature with drama, and it occurs to me that HTML is chock-full of boring boffiny tags for computer geeks – var,kbd,samp, and other yawntabulous things. What about the artists, eh?

So I demand the ability to define “poetry”-style non-structural line breaks: if the browser has broken a line at an arbitrary point due to font size, width of a contiainer etc, the continuing line should either be right-justified or significantly indented (at the coder’s discretion), in order that structure and presentation of the poem be seperated in the reader’s mind.

Line breaks in poetry: form is function

All poetry has author-defined breaks, which are best marked up using <br /> as they are structural. They carry meaning – as is clearly illustrated in the line break explorer and perfectly exemplified in William Carlos Williams’ The Red Wheelbarrow. The line break begins a new line, justified with those above it, as normal.

But traditional printed poetry books have always used a different convention for “soft” line breaks introduced because the page width was too small to accommodate the full length of a line – particularly very old books which used small type in two columns per page.

Here’s an example from one of my most treasured books – a 1911 printing of “Pre-Shakespearean Renaissance Drama”. This shows part of Dr Faustus’ final speech from the eponymous play by Marlowe. I’ve highlighted the words that have been given a “soft” line break because of the thin columns; note that they’re indented so the reader can distinguish them from an authorial line-break.

Now, I am the first to agree that the web’s not print, but it is vital to the understanding of a poem to know which linebreaks are structural, and which (like those above) are presentational. It’s more important on the web than in books, as any user can resize any page exactly when and how (s)he feels.

CSS suggestion

I suggest, therefore, that CSS3 includes a new ::line-break pseudo-element. It needs to be a pseudo-element, because the only the browser knows where it will put soft line-breaks. It’s similar to the ::first-line pseudo-element, which “knows” where the browser has put a soft line-break. My test page shows that, as you resize the browser width, the red font applied by the ::first-line style is shorter or longer depending on where the browser has put the linebreak.

With a ::line-break pseudo-element, I could write rules something likep.stanza::line-break:after {margin-left: 5em;}
which would indent the continuation of the line, as in the 1911 example above.

Or a rule likediv.poem *::line-break:before {background-image:url(continued-next-line.gif);}
could put a “continued next line” image immediately before the soft line break, as in this screenshot from A List Apart:

Why does this matter?

The web is an ideal medium for the dissemination of poetry or song lyrics, as the economics of poetry publication makes it extremely difficult for authors to be published in print. So, come on W3C: PROVIDE PROPER POETIC PRESENTATIONAL POSSIBILITIES – NOW!!.

(To any of you who thought an English Lit degree is easy, look at Carlos William’s sixteen-word poem The Red Wheelbarrow and tremble at the thought of my mighty 5000 word undergraduate essay on its structure.)

It’ll never happen. I’ve been complaining about this for years, but in the context of HTML for newspaper and magazine publishing, where we need structures like hed, dek, lede, byline (several kinds), cq, and tk, among others. The response from Tantek was a huffy dismissal that newspaper sites already aren’t using XHTML properly, so there’s no demand for semantics of this kind.

I would make another crack about Aspergerian geeks having no culture and running the show at W3C just for themselves, but then I’d be denounced for picking on people with that disability (though I am merely picking on their behaviour).

You’re much more versed in the mysteries of the w3c, Joe. For the benefit of readers (which is of course code for “I personally don’t have a fucking clue”), how would one go about lobbying our too-nervous-to-set-Standards chums for additions to css/ xhtml?

We’ve used TEI-Lite to mark up historical correspondence. It has also been used to mark up poetry so maybe something can be done using TEI elements inside XHTML documents. After all, there’s nothing wrong with using elements from more than one namespace in an XML document, as long as your browser or reader or whatever can understand them.

While it is a bit distasteful, you should be able to implement this by having each line in a block and then setting the indent-related CSS properties on that block to indent any text that is given a soft line-break.

@Chris: I was thinking the same thing about using a negative text-indent on the first line. However, any lines after a hard-break ([br]) would be indented along with the soft-wrapped lines. Using p tags instead of br tags would work only if the p tags were styled to not have any top or bottom margins, but if the reader was using a non-visual browser the poem wouldn’t “read” properly.

I work for Opera, but all opinions contained herein are mine (and are thus incontrovertibly
correct) and do not represent the opinions of my employers. (Comments are copyright their authors, not written by me, and
are therefore probably the ramblings of mad people.)