foo<br> bar
foo bar
The latter has a style rule applied: white-space:pre-line
.
(If rel="inspired-by"
existed it would point to this forum thread.)
Alas, I don't read Dutch. But one thing to be considered in thinking about your example is: are some semantics (content semantics, not markup-language semantics) lost if you disable CSS?
For instance, if you were trying to present a mailing-address, you would not want the lines to run together if CSS were disabled or white-space:pre-line
unsupported. So <br />
would be preferable.
Similarly, if you were presenting a poem or song-lyrics.
In each case, line-breaks are an integral part of the syntax of the content, and so should be reflected in the semantics of the markup.
That is why I chose <br /> for my lyrics site rather than CSS.
In the second example, the line break is presentational. In the first example, it is important for the meaning of the sentence/header/whatever. That is the difference.
Perhaps my examples should be less abstract next time.
The pre
element is poorly defined in the HTML 4.01 specification, but rather well-defined in the 2004-07-22 draft of XHTML 2.0:
The
pre
element indicates that whitespace in the enclosed text has semantic relevance, and will normally be included in visual renderings of the content.
Therefore, it's all up to if the whitespace has semantic relevance or not.
Again, the br
element is poorly defined in HTML 4.01; however, it's non-existant in the 2004-07-22 draft of XHTML 2.0!
I still get line breaks here with "user style" in Opera and "no style" in Firefox.
Because of the PRE element, I guess? Is the PRE element equivalent to white-space:pre; ?
I tried to test a style attribute in this comment, but your machine won't let me.
Charl, the PRE
element is white-space:pre
and has nothing to do with the issue at hand.
Jan, the above are code examples. Not examples of rendering. And no, I will never allow the STYLE
attribute in comments. Actually, I will try to avoid it when I can and do not need a quick fix.
Anne: Sorry, I realise that now. I think I misunderstood your article a little. You should be a little less minimalistic on your accompanying text in your posts for those of us that don't want to read a 10-page thread. :-)
I just throught about something else: XHTML 2.0 has the l
(line) element replacing the br
element which is very nicely defined too!
And thank god XHTML 2.0 has <l>
, because the <br/>
semantics are just as useless as the <hr/>
semantics.
And the presentational <hr/>
element will be replaced by the semantic <separator/>
element. :)
The XHTML2 seperator
element is just as poorly structured as hr
though, even if it is a semantically better name.
But more difficult to spell for native-English speakers, I gather? ;)
If rel="inspired-by" existed it would point to this forum thread.
Have you thought about rel="related"? Arve has an interesting post about this today.
I have. It is not really related though and not really relevant for the discussion here either although some people only seem to understand my post after reading it. :-)