WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: H1 header in iframe


From: John Foliot
Date: Aug 25, 2010 8:33AM

Jared Smith wrote:
> >
> > Should an HTML page contained in an iframe always start with an h1?
> Because the iframe is accessed as if it were content of the parent
> page, the headings within the iframe should be structured
> appropriately. If the iframe contains the main first level heading for
> the entire document, then make it an <h1>. Otherwise lower level
> headings (or no headings at all) may be appropriate.

As an additional point to Jared's, HTML5's <hgroup> element will be of
significant importance here (I believe) as the browser will be
're-interpreting' headings based on the total document's hierarchal
structure (see: http://html5doctor.com/the-hgroup-element/ for a good

In effect, mark up each document as appropriate if it were a stand-alone
document (so yes, include at least 1 <h1>) but when a 'container' document
imports such secondary documents (inside the <hgroup> element) the browser
"knows" that even though the imported document starts with an <h1>,
because it is inside a document that already has an <h1> that this second
instance, in this context, is actually a sub-heading (ergo <h2>) of the
parent document, and adjusts its hierarchal semantic to reflect this.
(Yes, it's kind of mind-bending at first, but actually quite intelligent
and useful. - Read the article, it does a much better job than I of
explaining it)