PDA

View Full Version : Is <hr /> (X)HTML's "goto"?


Vladdy
07-23-2003, 11:03 PM
Just an invitation to a philosophical discussion (like we don't have enough of those :D ):
I spent an hour (route 3 traffic can be such a drag) trying to come up with a ligitimate use of horizontal rule in a semantically structured document, and finally came to conclusion that any document can be made without it. Any thoughts?

brothercake
07-24-2003, 12:56 AM
Horizontal rules are logical dividers, and I always use them. In a complex page I'd have several of them, most or all of which are invisible to CSS-browsers, because the real value of <hr> is in a linearised layout.

Take a two-column CSS layout - the columns are visual content dividers made out of CSS borders; but a non-CSS browser has no indication of those divisions. That's exactly where <hr> is useful; necessary even. Something like this:


<div>... logo and header ...</div>

<hr class="notThere" />

<div>... main content ...</div>

<hr class="notThere" />

<div>... right-column content ...</div>

<hr class="notThere" />

<div>... navigation ...</div>

In that example, "notThere" would be "display:none" in visual CSS, but normal display in print media (assuming you linearise for print ;)), and of course normal to non-CSS browsers. The dividers can nicely co-incide with <h2> or <h3> headings, and could also be the main target points of the page's internal anchors; for example:

<hr class="notThere" />

<div id="rightColumn">

<a name="rColumn" id="rColumn"></a>

<h2>Column Heading</h2>

<p> ... etc ... </p>

</div>

So yeah - <hr> definitely has semantics, and an important place in XHTML :)

meow
07-24-2003, 09:40 AM
http://www.cs.tut.fi/~jkorpela/html/empty.html#html
[http://htmlhelp.com/reference/html40/block/hr.html]
...and endless threads at the w3 mailing lists.

Semantic? Nah...I doubt empty elements can be semantic. It has even been argued that they have no place in a markup language in the first place. But I like HR too. It looks so good in Lynx. :o

brothercake
07-24-2003, 06:01 PM
It may be true that dividing lines shouldn't be necessary in a strict SGML language, but HTML is not that strict, and dividers are necessary - for Lynx, and any browser which sees a linearised page.

The semantics of <br> and <img> are dubious, sure, but what about <input> - it's an empty element, but its semantics are undeniable. <link> also has semantics - it means an association, while leaving the nature of that association (hyperlink, include, transclude etc) to be defined in attributes.

I think <hr> is one of these - it may not have semantics in SGML, but I really think it does have semantics in XHTML.

At the very least, it's necessary in practise.

ronaldb66
07-25-2003, 07:38 AM
it's necessary in practise Hahaaaa, that's what they said about table layouts and font tags too, back then... :D
I can't escape the feeling that hr has somewhat of a presentational character; I guess it's one of those things that are right on the threshold.

brothercake
07-25-2003, 07:45 AM
Originally posted by ronaldb66
Hahaaaa, that's what they said about table layouts and font tags too, back then... :D

They did say that, but it was never really true ;) expectations change.

<hr> is not about design the way those were, it's about structure, and it serves a usability and accessibility purpose - it aids comprehension of the document as a whole.

I think the lack of any <card>-style group container implies a purpose for <hr> - it has to be used in the absence of anything better.

in loco semanticus, as it were :cool:


(hey, I wonder if XHTML 2 has anything to address this ...?)

meow
07-25-2003, 09:23 AM
dividers are necessary - for Lynx, and any browser which sees a linearised page
The keyword here is 'sees'. It's presentational even if it's in Lynx.

In what way is a HR necessary? The text is already formatted in headings and paragraphs and so on, isn't it?

Admittedly a HR can LOOK nice but it has as much semantics as my old socks.:o