Proper use of heading tags
Home / Site Building & Testing / Proper use of heading tags
At http://www.w3.org/... it says:
| Quote: | ||
The following example shows how to use the DIV element to associate a heading with the document section that follows it. Doing so allows you to define a style for the section (color the background, set the font, etc.) with style sheets.
|
If a browser strictly goes by that, then the browser might not look above my img tag for the start of the container that the heading applies to and I'd need to turn the image into a background image for the div tag, or something.
_________________
• PoliSource.com - Politics & public affairs resources •
_________________
Patrick H. Lauke / webmaster / University of Salford
co-lead: WaSP Accesibility Task Force
take it to the streets ... WaSP Street Team
personal: splintered | photographia | redux
co-author: Web Accessibility - Web Standards and Regulatory Compliance
| Code: |
| <h1>Top level heading</h1>
<p>...text...</p> <div class="section"> <h2>Sub heading</h2> <p>...text...</p> <div class="section"> <h3>Sub-sub heading</h3> <p>...text...</p> </div> </div> |
| Code: |
| .section { margin: 0 5%; } |
_________________
Simon Pieters
But I think I'll "not worry too much about it" and stick with what I have.
_________________
• PoliSource.com - Politics & public affairs resources •
| Wassercrats wrote: |
| Is it important for a heading tag to be immediately preceded by a opening block-level element? |
Not at all. The heading is 'associated' with the following text and has very little to do with anything that comes before it.
I see nothing wrong with doing things the way you do.
_________________
Tommy has left the building
The <div> element will still be useful as a semantically neutral container for things. It can contain a number of <section> elements, for instance.
_________________
Tommy has left the building
So h1-6 will be depreciated in XHTML 2.0? How far away is it from being official anyways?
_________________
Kyle J. Lamson
Analyst/Programmer III, State of Alaska
--
LSW-WebDesign.com & DarkShadow-Designs.com
| lsw wrote: |
| So h1-6 will be depreciated in XHTML 2.0? How far away is it from being official anyways? |
I don't know if the old heading will be deprecated, but there's not much use for them if we get <section> and <h> elements.
I don't think XHTML 2 is anywhere near becoming an official recommendation. And once it's official, it will probably be another 15 years or so to before a majority of the browsers in use support it. (I.e. before it becomes fully usable.) We're not even there with XHTML 1 yet, for crying out loud.
_________________
Tommy has left the building
| TOOLman wrote: |
| A <div>ision is semantically neutral. A <section> marks up a section, which is a collection of paragraphs (and other things), just like a paragraph is a collection of sentences. |
I guess my point was - why don't they just bestow some semantic value upon division instead of introducing a 'new' element?
The notions of 'division' and 'section' are pretty much synonymous everywhere else in their use, so why not simply reflect that here?
I can't (yet) see how section will differ from division in practical terms - particularly when looking at the XHML 2.0 example posted earlier.
I don't see how they've added any real value to the scheme.
| Bill Posters wrote: |
| I guess my point was - why don't they just bestow some semantic value upon division instead of introducing a 'new' element? |
Because there's still a need for a semantically neutral block-level element. Sometimes you want to group elements (e.g. to position a bunch of them together), but those elements may not be a document section.
That's like saying, 'what do we need a SPAN element for when we've got EM?'
_________________
Tommy has left the building
| Bill Posters wrote: |
| why don't they just bestow some semantic value upon division instead of introducing a 'new' element? |
going off topic, but i hate the idea of their proposed navigation list. it's good that they're thinking about making some more specific elements, but their solution will not work in every situation. they're being far too specific, and risk ending up with a myriad of very, extremely specific elements which, once again, won't fit all real-life content anyway.
anyway, rant over...
_________________
Patrick H. Lauke / webmaster / University of Salford
co-lead: WaSP Accesibility Task Force
take it to the streets ... WaSP Street Team
personal: splintered | photographia | redux
co-author: Web Accessibility - Web Standards and Regulatory Compliance
| TOOLman wrote: | ||
Because there's still a need for a semantically neutral block-level element. Sometimes you want to group elements (e.g. to position a bunch of them together), but those elements may not be a document section. That's like saying, 'what do we need a SPAN element for when we've got EM?' |
I thought the whole idea was to move towards slimmer, more semantically dense markup from which we simply hang the visual design.
I do kinda get it, I just think that it might be a concession to non-semantic markup habits.
Fwiw, I'm not convinced we do need <span>.
If it's worth highlighting or gathering in some way, then presumably there's semantic value in reflecting it with the use of a semantically useful tag rather than span.
I honestly don't recall the last time I used span - or saw an instance where a task was best served by a span tag rather than a semantically useful one.
(Not forgetting that semantic tags can most often be visually 'neutralised' so as retain semantic and structural meaning without necessarily having to convey visual distinction.)
All times are GMT
You cannot post new topics in this forumYou cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


