Skip to content

Commit a105da3

Browse files
close #116 | encourage to explicitly wrap sections in elements
1 parent cae81ef commit a105da3

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

index.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,29 @@ <h1>Code snippet of a section.</h1>
112112
<p>The example shows a section with a heading and two paragraphs, a lower level heading and another paragraph.</p>
113113
</figcaption>
114114
</figure>
115+
<p>The code snippet above shows an example of <a href="https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_HTML_sections_and_outlines#Implicit_sectioning">implicit sectioning</a>, where both the <code>&lt;h1&gt;</code> and <code>&lt;h2&gt;</code> elements are in the same section. Authors are encouraged to <em>explicitly</em> wrap sections in elements of <a href="https://www.w3.org/TR/2014/REC-html5-20141028/sections.html#headings-and-sections">sectioning content</a>, instead of relying on the implicit sections generated by having multiple headings in one <code>&lt;section&gt;</code> element.</p>
116+
<figure>
117+
<pre><code>&lt;main&gt;
118+
&lt;article&gt;</code>
119+
<mark><code> &lt;section&gt;
120+
&lt;h1&gt;...&lt;/h1&gt;
121+
...
122+
&lt;section&gt;
123+
&lt;h2&gt;...&lt;/h2&gt;
124+
...
125+
&lt;section&gt;
126+
&lt;h3&gt;...&lt;/h3&gt;
127+
...
128+
&lt;/section&gt;
129+
&lt;/section&gt;
130+
&lt;/section&gt;</code></mark>
131+
<code> &lt;/article&gt;
132+
&lt;/main&gt;</code></pre>
133+
<figcaption>
134+
<h1>Explicit sectioning.</h1>
135+
<p>Sections in HTML5 can be nested, use headings of the appropriate rank for the section's nesting level. Explicit sectioning allows for <a href="https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_HTML_sections_and_outlines#Problems_solved_by_HTML5">predictable document outlines</a> and better user experience.</p>
136+
</figcaption>
137+
</figure>
115138
</section>
116139

117140
<section>

0 commit comments

Comments
 (0)