This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 17894 - <h[2-6]> in <hgroup> should be relatively styled, like <h1> is
Summary: <h[2-6]> in <hgroup> should be relatively styled, like <h1> is
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: data:text/html,<!DOCTYPE%20html><html...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-18 07:13 UTC by contributor
Modified: 2012-12-30 20:03 UTC (History)
3 users (show)

See Also:


Attachments

Description contributor 2012-07-18 07:13:41 UTC
This was was cloned from bug 17787 as part of operation convergence.
Originally filed: 2012-07-16 14:35:00 +0000
Original reporter: Gordon P. Hemsley <gphemsley@gmail.com>

================================================================================
 #0   Gordon P. Hemsley                               2012-07-16 14:35:33 +0000 
--------------------------------------------------------------------------------
When an <h1> is inside an element like <section>, it is treated like a header of that section and is styled relative to the section rather than the whole page. However, if any of the other headers are used in the same way, they are only styled relative to the page.

If, for example, an <h1> and <h2> are within an <hgroup> within a <section>, the <h1> will be styled relative to the section while the <h2> is styled relative to the page. This results in the <h1> actually being smaller than the <h2>, even though they are actually part of the same header and should maintain their relative size difference.

A minimal testcase is included in the URL field.

I have also filed a Mozilla bug on the matter:
https://bugzilla.mozilla.org/show_bug.cgi?id=774098
================================================================================
 #1   Gordon P. Hemsley                               2012-07-16 14:37:34 +0000 
--------------------------------------------------------------------------------
Created attachment 1159 [details]
Extended testcase

This is a more expanded testcase that demonstrates exhaustive embedding of all <hN> sizes.
================================================================================
Comment 1 Ian 'Hixie' Hickson 2012-09-28 19:40:14 UTC
Not styling h2-h6 differently based on section level in general is intentional, so that you can get the same results in legacy UAs as new UAs.

Hadn't considered <hgroup>, though. Not sure what to do about that case.
Comment 2 Ian 'Hixie' Hickson 2012-12-30 00:51:06 UTC
This is easy if we only want to support

   <hgroup>
     <h1>...</h1>
     <h2>...</h2>
   </hgroup>

...and almost as easy if we want to support further levels like that.

But in CSS currently it's basically impossible if we want to support these:

   <hgroup>
     <h2>...</h2>
     <h1>...</h1>
   </hgroup>

...while still not restyling cases like this, so they work in back-compat cases:

   <hgroup>
     <h2>...</h2>
     <h3>...</h3>
   </hgroup>

So should we just support the top one of these? It's better than nothing...
Comment 3 Gordon P. Hemsley 2012-12-30 03:25:07 UTC
(In reply to comment #2)
> This is easy if we only want to support
> 
>    <hgroup>
>      <h1>...</h1>
>      <h2>...</h2>
>    </hgroup>
> 
> ...and almost as easy if we want to support further levels like that.

I believe that's what I intended: the most basic case.

> But in CSS currently it's basically impossible if we want to support these:
> 
>    <hgroup>
>      <h2>...</h2>
>      <h1>...</h1>
>    </hgroup>
> 
> ...while still not restyling cases like this, so they work in back-compat
> cases:
> 
>    <hgroup>
>      <h2>...</h2>
>      <h3>...</h3>
>    </hgroup>

What are the usecases for having reverse headers in an <hgroup>? And what are the backwards-compatibility issues for a tag that was introduced with HTML5? Are there really sufficiently entrenched parsers that couldn't be updated to handle any necessary changes?

> So should we just support the top one of these? It's better than nothing...

The CSS I intended to be able to handle this is attached to the Mozilla bug I mentioned in bug 17787 comment 0:
https://bug774098.bugzilla.mozilla.org/attachment.cgi?id=642582
Comment 4 Ian 'Hixie' Hickson 2012-12-30 20:03:45 UTC
The "sufficiently entrenched parsers" are those in already-shipped browsers that users aren't updating. IE6, for example. The idea is that you can use <section> and <hgroup> while using <h2>-<h6> in the old fashion, and the result is that the headings, even without CSS, render at the "right" levels in old UAs.

"Reverse headers" do occur, but I'm fine with not supporting them in the default CSS. They're pretty rare.

(The performance implications of the selector I used in the spec are a bit worrisome, hopefully implementors find better solutions...)
Comment 5 contributor 2012-12-30 20:03:57 UTC
Checked in as WHATWG revision r7616.
Check-in comment: Add support for automatic sizing of headings in <hgroup> if they follow <h1>.
http://html5.org/tools/web-apps-tracker?from=7615&to=7616