SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,276
    Mentioned
    50 Post(s)
    Tagged
    2 Thread(s)

    To h1 everything or not: current answer is "don't".

    Those who've been following the HTML5 spec(s) have surely heard of the document outline, where certain elements (such as header, footer, aside, section, article...) set up a semantic structure to a page whereby the architectural outline of the information on the page can be... I dunno. More easily parsed by software? Or something.

    Anyway along with this came back an old idea from XHTML2, which proposed a sort of EveryHeading: <h>. With the new document outline in place, h1 could serve as the generic heading for each level of the outline, meaning software parsing the page would realise that a <h1> within an <article> who was within a main <section> who was the main child of the body with its own <h1> would be considered an <h2> instead. Or something like that.

    The idea has pros and cons. One of the main pros is "syndication": that your "main" article on your website (<h1>How to Change a Tire-- an article by Joe</h1>) would, if copied over to the Motorcycle News site as one of several maintenance articles (where the section heading is <h2>Maintaining your Bike</h2>), then Joe's <h1> would now be interpreted as an h3 and the heading levels would make sense to all software, without manual human intervention. You would magically end up with this:

    <h1>Motorcycle News</h1>
    <p>...for all your motorcycle articles.</p>
    ...other sections...

    <h2>Maintaining your Bike</h2>

    ..maintenance articles...
    <h3>How to Change a Tire -- an article by Joe</h3>
    blah blah...


    Well that's awesome and peaches, but there's problems: it doesn't actually do this. There isn't software today consuming HTML with the outlining algorithm (well, there is the outline checker at w3 tho... :D ) and there's plenty out there which does not, meaning anything older than the latest nightly of something is seeing... just h1's everywhere.

    Of course, this also means AT (accessibility technology), where headings are not just structural components, but also (mostly due to crappily-built pages) a major navigation component. Users of these technologies not only rely on there being headings, but the headings being the correct level for the nesting of the content beneath it.

    So, currently, the specs have been formally changed (for now) to no longer encourage using only h1's, or to let devs think that using only h1's and relying on the document outline is in any way recommended.

    http://lists.w3.org/Archives/Public/...3Feb/0125.html

    The more you know.

  2. #2
    Mouse catcher silver trophy Stevie D's Avatar
    Join Date
    Mar 2006
    Location
    Yorkshire, UK
    Posts
    5,888
    Mentioned
    122 Post(s)
    Tagged
    1 Thread(s)
    Even ignoring the problem that the technology isn't ready to deal with hierarchical headings taking their structure from the document outline, I've never been a fan of using the same tag to mark up all headings. Why? It makes life so much more difficult for you.

    For a start, it means you have to use <section> blocks (or other equivalents?), which is an extra lot of code to put in, causes extra scope for confusion and for closing blocks in the wrong place, or not closing enough, or closing too many ... and for no real benefit that I can see. It's just a galloping case of <divitis> with a different tag name.

    For a second, nothing I've ever seen suggested that the browser would consider an <h1> that was subordinate to another <h1> that was subordinate to another <h1> as an <h3>, eg for styling purposes. So instead of having
    h3 {...}
    you would have
    section section section h1 {...}
    and I'm really not convinced that that is an improvement.

    And for a third, you then have to be far more careful when writing and maintaining the site, because it won't be obvious when you look at <h1>Heading here</h1> what level heading it is ... you'll have to look back up through the various nested <section> tags to see what level it's actually at, and the chances are pretty high that you'll mis-count and get it wrong anyway.

    And for what benefit? The suggestion that it would allow better structured syndicated content is nebulous at best, and non-existent for the vast and overwhelming majority of authors. Forget it, and just stick to numbered heading levels!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •