0

On my home page I'm using a h1 tag for the site title.

On internal pages I'm using h1 for the page title, but I'm wondering what is the best way to mark up the site title on these pages in XHTML?

Martin Buberl
  • 45,844
  • 25
  • 100
  • 144
wheresrhys
  • 22,558
  • 19
  • 94
  • 162

2 Answers2

2

The H1-H6 tags are semantic tags and should be used the same way in XHTML.

Oded
  • 489,969
  • 99
  • 883
  • 1,009
  • The problem in XHTML though is that no heading should come before the H1 tag in the source. IN HTML5 you can get around this using sections, so on pages other than the home page you could use something like
    . Personally, I think the XHTML specification is way too primitive to enable you to mark-up documents in a sensible way all the time, so I'm really asking what the best compromise markup is
    – wheresrhys Mar 10 '11 at 16:28
  • Why can't you use `H1` and style it? – Oded Mar 10 '11 at 16:55
  • Because accessibiilty guidelines recommend that each page has only one H1 tag, and that tag refers to the content of the page. On the home page of the site it's fine to have the site title in a H1 as that page is about the site, but on an internal page the content will be about something else, so having the H1 putting undue emphasis on the site title is misleading/annoying for e.g. screen reader users – wheresrhys Mar 17 '11 at 09:24
2

If you're looking at XHTML 1, I tend to use a <div> on inner pages to mark up the site's name, perhaps with a <strong> for some emphasis. For accessibility purposes, if you are including the site's name in the page title, you should be mostly covered by that. Screenreader software tend to read out the page title when pages first load, and that info is readily available to a user (Insert-T keystroke in JAWS for Windows).

XHTML 2 actually has a better solution, which is similar to what HTML 5 does, allowing you to build heading hierarchies per section. Bruce Lawson explains this best: Headings in HTML 5 and Accessibility

Jon Gibbins
  • 887
  • 7
  • 14