|Now that < br /> is deprecated, how should we be replacing it?|
How would you handle a poetic situation like this?
| 11:58 am on Feb 12, 2004 (gmt 0)|
I'm trying to go with "web standards" xhtml as much as possible. But I keep bumping into situations like this:
<p class="margintop3em singlespace bold">"To write love-letters is human.<br />
But to preserve them that they may one day<br />
from a witness stand add to the gayety of multitudes<br />
is downright philanthropic."</p>
<p class="marginleft2em">—from an editorial, <em>The Baltimore American</em>, June 1904.</p>
The client wants to control the breaks for poetic effect. That's understandable, but if I transform it into something without < br />s eveything I've tried becomes much less efficient. Here's one miserable example:
<ul style="margin-left: 0;"><li class="bold">"To write love-letters is human.</li>
<li class="bold">But to preserve them that they may one day</li>
<li class="bold">from a witness stand add to the gayety of multitudes</li>
<li class="bold">is downright philanthropic."</li></ul>
<p class="marginleft2em margintop-pt8em">—from an editorial, <em>The Baltimore American</em>, June 1904.</p>
These both look the same, but the second is heavier and its code is harder to read.
If I read Zeldman [informit.com] correctly, like here:
his advice not just to avoid using structural tags for presentation, but to also change our minds about the need to layout the page so intensely.
Taken to the extreme, that'd put the e.e. cummings out of work. Well, they probably ARE out of work!
So, I looked for help for this on the W3.org site [w3.org] which says:
|The br element indicates that the current output line should be ended at this point, and a new line begun. This element is deprecated in favor of the line element. |
W3.org also talks about LINE [w3.org]:
|The line element represents a sub-paragraph. It is intended as a structured replacement for the br element. It contains a piece of text that when visually represented should start on a new line, and have a line break at the end. Whether the line should wrap or not visually depends on styling properties of the element. |
By retaining structure in text that has to be broken over lines, you retain essential information about its makeup. This gives you greater freedom with styling the content. For instance, line numbers can be generated automatically from the stylesheet if needed.
Line, however, doesn't work yet in the IE6 & Opera 7 browsers I tested it in.
And W3.org also talks about the PRE tag [w3.org] at:
|The pre element indicates that whitespace in the enclosed text has semantic relevance, and will normally be included in renderings of the content |
Note that all elements in the XHTML family preserve their whitespace in the document, which is only removed on rendering, via a stylesheet, according to the rules of CSS [CSS]. This means that in principle all elements may preserve or collapse whitespace on rendering, under control of a stylesheet. Also note that there is no requirement that the <pre> element be rendered in a monospace font (although this is the default rendering), nor that text wrapping be disabled.
Pre works, but seems rather limited in terms of css.
At this point, "I'm tending toward Keep It Simple, Stupid."
How would you handle this?
| 12:08 pm on Feb 12, 2004 (gmt 0)|
Use <br />. xhtml2 isn't here yet, and even if it does arrive, you won't have to suddenly switch all your pages to it to make them work (quite the contrary ;)).
| 12:10 pm on Feb 12, 2004 (gmt 0)|
I wouldnīt actually go with <line> as long as there are buggy browsers like IE so heavy in use.
If you donīt want to use <br /> anymore you could try
<span class="break">First Line ends with a break,</span>
and the next lines go on as usual.
Now define .break as "display:block;clear:both;" in your external stylesheet.
| 12:33 pm on Feb 12, 2004 (gmt 0)|
|I wouldnīt actually go with <line> as long as there are buggy browsers like IE so heavy in use. |
<line> is new in xhtml2. xhtml2 is still draft, and no browser supports it AFAIK.
| 3:23 pm on Feb 12, 2004 (gmt 0)|
The break tag is not in any way deprecated... and never will be. As long as your document validates against any of the HTML document definitions, or against definitions such as XHTML 1 or XHTML 1.1 it will be valid. And, for that matter, you can define it yourself, and make a custom DTD too.
However, to get back to your point, about the break tag being deprecated in XHTML2...
|This document is the fifth public Working Draft of this specification. It should in no way be considered stable, and should not be normatively referenced for any purposes whatsoever. |
XHTML has not yet become an official recommendation. It currently has no browser support. And, still, as long as you validate against a DTD that uses break tags -- you're fine!
Even if you wanted to validate against XHTML2 -- well, turning those lines into a list is not an option. If they are to be considered a list under XHTML2, then they are to be considered a list under previous definitions as well. You need to use the <line> tags. But, since they are not supported (and since things may yet change before the official recommendation) you are better off forgetting about XHTML2 for now.
There is today no reason whatsoever to worry about XHTML2 for reasons other than educational purposes.
| 3:40 pm on Feb 12, 2004 (gmt 0)|
DrDoc is absolutely correct... no need to worry about it except for educational purposes..
there's not going to be loads of broken sites all over the place ;)
There was a discussion about this issue [webmasterworld.com] here a while back, but it was more along the lines of what the W3 are still trying to agree on too by the looks of things..
Read the W3 issues still under discussion [w3.org] for XHTML2
both the <l> (line) and <br /> issues are unresolved (as is anything in light green..)