What if custom element type <html5-h>
or XHTML2’s <h>
or HTML5’s <hgroup>
could be substituted by existing <hr>
? It would play an important part in the outline algorithm.
Example 1: <h1>
with <h2>
<hr>
<h1>I’m a heading</h1>
<h2>I’m a subheading</h2>
</hr>
Example 2: <h1>
with <p>
<hr>
<h1>I’m a heading</h1>
<p>I’m a subheading</p>
</hr>
Example 3: <h1>
with <subhead>
<hr>
<h1>I’m a heading</h1>
<subhead>I’m a subheading</subhead>
</hr>
Example 4: anonymous with <subhead>
<hr>I’m a heading
<subhead>I’m a subheading</subhead>
</hr>
Example 5: anonymous with <h2>
<hr>I’m a subheading
<h2>I’m a heading</h2>
</hr>
Example 6: just anonymous
<hr>I’m a heading</hr>
Considerations
-
XHTML: Standalone
<hr>
would be a syntax error, with</hr>
it parses just fine, therefore the empty<hr/>
can be a special case of the generichr
heading container, rendered as a divider as it has always been. -
HTML4:
</hr>
is ignored, hence<hr>
and<hr />
are always dividers. Authors might choose to supply some CSS rule like this:hr:empty {display: none;}
-
HTML5: Legacy content with
<hr>
would open an element that is never closed. Therefore special rules for automatic closing are necessary, e.g. only anonymous text nodes andh#
headings could be allowed as (first) contents. That means,<hr><p>…
would constitute an empty heading container followed by a normal paragraph, hence Example 2 above would not work. -
Legacy browsers: Some legacy content may use
</hr >
(like</br>
) and assume it works the same as with the slash at the end or without it. That’s certainly the case with similar</br>
.