Header tags: how do you use h tags in themes?
-
Here’s a question I’ve been asking myself over the last couple of months as I’ve been planning and writing a theme for WordPress: how hierarchical should my header tags be; what header tags should I use in my #header, #content and #sidebar divs? I wondered what other users’/developers’ thoughts are.
In my searches on Google I discovered a good article on the CollyLogic website entitled “Question Time: Using H Tags” https://www.collylogic.com/index.php?/weblog/commentsfull/question_time_using_h_tags/
but I wondered what other, specifically WordPress, users’ practices were. Is there a convention about this? (I’ve done a search on the support forums here but didn’t immediately find anything.)Having read and been converted to writing validating xhtml by Jeffery Zeldman’s book “Designing with Web Standards” I’ve been revisiting old sites of mine and been appalled by my over-abundant use of class tags to even style the humble
<p>
tag in my #content divs, and my use of header tags to style text rather than describe it logically within the hierarchy of the document.As I (now!) understanding it, the header tags describe the hierarchical importance of a document. So my question is really about what tags do you use where? For example, do you follow the understanding that any document should have only one h1 tag, in the #header div, for example? And what of sidebars, what h tags do you use there; should you return to h2 for sidebars, or follow on from where you left off in the #content div?
After much thought and a little reading around I’ve decided on the following with my WordPress 1.5 theme:
h1 #header title
h2 #content page title
h3 #content post title
h4 #content subheader (inserted into the post text by me)
h5 #sidebar headers
h6 not currently usedThis way when I write my
print.css
file I’m not having to worry about how many hn tags I have in different divs (#header, #content, #sidebar, #footer) but know that it logically describes the outline of the page from header through content to sidebar.As I said, I wondered what other users’ thoughts and practices were.
Gareth
- The topic ‘Header tags: how do you use h tags in themes?’ is closed to new replies.