diff options
Diffstat (limited to 'devdocs/html/element%2Fheader.html')
| -rw-r--r-- | devdocs/html/element%2Fheader.html | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/devdocs/html/element%2Fheader.html b/devdocs/html/element%2Fheader.html new file mode 100644 index 00000000..70bbebce --- /dev/null +++ b/devdocs/html/element%2Fheader.html @@ -0,0 +1,108 @@ +<header><h1><header></h1></header><div class="section-content"><p>The <code><header></code> <a href="../index">HTML</a> element represents introductory content, typically a group of introductory or navigational aids. It may contain some heading elements but also a logo, a search form, an author name, and other elements.</p></div> +<h2 id="try_it">Try it</h2> +<div class="section-content"><iframe class="interactive is-tabbed-standard-height" height="200" src="https://interactive-examples.mdn.mozilla.net/pages/tabbed/header.html" title="MDN Web Docs Interactive Example" loading="lazy"></iframe></div> +<h2 id="usage_notes">Usage notes</h2> +<div class="section-content"> +<p>The <code><header></code> element has an identical meaning to the site-wide <a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/banner_role"><code>banner</code></a> landmark role, unless nested within sectioning content. Then, the <code><header></code> element is not a landmark.</p> <p>The <code><header></code> element can define a global site header, described as a <code>banner</code> in the accessibility tree. It usually includes a logo, company name, search feature, and possibly the global navigation or a slogan. It is generally located at the top of the page.</p> <p>Otherwise, it is a <code>section</code> in the accessibility tree, and usually contains the surrounding section's heading (an <code>h1</code> – <code>h6</code> element) and optional subheading, but this is <strong>not</strong> required.</p> +</div> +<h3 id="historical_usage">Historical Usage</h3> +<div class="section-content"><p>The <code><header></code> element originally existed at the very beginning of HTML for headings. It is seen in <a href="http://info.cern.ch/" target="_blank">the very first website</a>. At some point, headings became <a href="heading_elements"><code><h1></code> through <code><h6></code></a>, allowing <code><header></code> to be free to fill a different role.</p></div> +<h2 id="attributes">Attributes</h2> +<div class="section-content"><p>This element only includes the <a href="../global_attributes">global attributes</a>.</p></div> +<h2 id="examples">Examples</h2> + +<h3 id="page_header">Page Header</h3> +<div class="section-content"> +<div class="code-example"> +<p class="example-header"><span class="language-name">html</span></p> +<pre data-signature="L7G//UQoT92KxgsueTIW6FV6GliHEvXaRlvwzGdZISw=" data-language="html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>header</span><span class="token punctuation">></span></span> + <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>h1</span><span class="token punctuation">></span></span>Main Page Title<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>h1</span><span class="token punctuation">></span></span> + <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>img</span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>mdn-logo-sm.png<span class="token punctuation">"</span></span> <span class="token attr-name">alt</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>MDN logo<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span> +<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>header</span><span class="token punctuation">></span></span> +</pre> +</div> <h4 id="result">Result</h4> +<div class="code-example" id="sect1"> + +<iframe class="sample-code-frame" title="Page Header sample" id="frame_page_header" src="https://live.mdnplay.dev/en-US/docs/Web/HTML/Element/header/runner.html?id=page_header" loading="lazy"></iframe> +</div> +</div> +<h3 id="article_header">Article Header</h3> +<div class="section-content"> +<div class="code-example"> +<p class="example-header"><span class="language-name">html</span></p> +<pre data-signature="8qwCAfsFt1eZe7t6xqKtQ2bLcTo97qCPxkqbd0pjmU4=" data-language="html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>article</span><span class="token punctuation">></span></span> + <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>header</span><span class="token punctuation">></span></span> + <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>h2</span><span class="token punctuation">></span></span>The Planet Earth<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>h2</span><span class="token punctuation">></span></span> + <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>p</span><span class="token punctuation">></span></span> + Posted on Wednesday, <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>time</span> <span class="token attr-name">datetime</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>2017-10-04<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>4 October 2017<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>time</span><span class="token punctuation">></span></span> by + Jane Smith + <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>p</span><span class="token punctuation">></span></span> + <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>header</span><span class="token punctuation">></span></span> + <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>p</span><span class="token punctuation">></span></span> + We live on a planet that's blue and green, with so many things still unseen. + <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>p</span><span class="token punctuation">></span></span> + <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>p</span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>https://example.com/the-planet-earth/<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>Continue reading…<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>p</span><span class="token punctuation">></span></span> +<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>article</span><span class="token punctuation">></span></span> +</pre> +</div> <h4 id="result_2">Result</h4> +<div class="code-example" id="sect2"> + +<iframe class="sample-code-frame" title="Article Header sample" id="frame_article_header" src="https://live.mdnplay.dev/en-US/docs/Web/HTML/Element/header/runner.html?id=article_header" loading="lazy"></iframe> +</div> +</div> +<h2 id="accessibility">Accessibility</h2> +<div class="section-content"><p>The <code><header></code> element defines a <a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/banner_role"><code>banner</code></a> landmark when its context is the <a href="body"><code><body></code></a> element. The HTML header element is not considered a banner landmark when it is descendant of an <a href="article"><code><article></code></a>, <a href="aside"><code><aside></code></a>, <a href="main"><code><main></code></a>, <a href="nav"><code><nav></code></a>, or <a href="section"><code><section></code></a> element.</p></div> +<h2 id="technical_summary">Technical summary</h2> +<div class="section-content"><figure class="table-container"><div class="_table"><table class="properties"> <tbody> <tr> <th scope="row"><a href="../content_categories">Content categories</a></th> <td> <a href="../content_categories#flow_content">Flow content</a>, <a href="../content_categories#palpable_content">palpable content</a>. </td> </tr> <tr> <th scope="row">Permitted content</th> <td> <a href="../content_categories#flow_content">Flow content</a>, but with no <code><header></code> or <a href="footer"><code><footer></code></a> descendant. </td> </tr> <tr> <th scope="row">Tag omission</th> <td>None, both the starting and ending tag are mandatory.</td> </tr> <tr> <th scope="row">Permitted parents</th> <td> Any element that accepts <a href="../content_categories#flow_content">flow content</a>. Note that a <code><header></code> element must not be a descendant of an <a href="address"><code><address></code></a>, <a href="footer"><code><footer></code></a> or another <a href="header" aria-current="page"><code><header></code></a> element. </td> </tr> <tr> <th scope="row">Implicit ARIA role</th> <td> <a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/banner_role">banner</a>, or <a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/generic_role">generic</a> if a descendant of an <code><a href="article">article</a></code>, <code><a href="aside">aside</a></code>, <code><a href="main">main</a></code>, <code><a href="nav">nav</a></code> or <code><a href="section">section</a></code> element, or an element with <code>role=<a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/article_role">article</a></code>, <code><a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/complementary_role">complementary</a></code>, <code><a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/main_role">main</a></code>, <code><a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/navigation_role">navigation</a></code> or <code><a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/region_role">region</a></code> </td> </tr> <tr> <th scope="row">Permitted ARIA roles</th> <td> <a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/group_role"><code>group</code></a>, <a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/presentation_role"><code>presentation</code></a> or <a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/none_role"><code>none</code></a> </td> </tr> <tr> <th scope="row">DOM interface</th> <td><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement"><code>HTMLElement</code></a></td> </tr> </tbody> </table></div></figure></div> +<h2 id="specifications">Specifications</h2> +<div class="_table"><table class="standard-table"> +<thead><tr><th scope="col">Specification</th></tr></thead> +<tbody><tr><td><a href="https://html.spec.whatwg.org/multipage/sections.html#the-header-element">HTML Standard <br><small># the-header-element</small></a></td></tr></tbody> +</table></div> +<h2 id="browser_compatibility">Browser compatibility</h2> +<div class="_table"><table> +<thead> +<tr id="bct-browser-type"> +<th></th> +<th colspan="6">Desktop</th> +<th colspan="6">Mobile</th> +</tr> +<tr id="bct-browsers"> +<th></th> +<th>Chrome</th> +<th>Edge</th> +<th>Firefox</th> +<th>Internet Explorer</th> +<th>Opera</th> +<th>Safari</th> +<th>WebView Android</th> +<th>Chrome Android</th> +<th>Firefox for Android</th> +<th>Opera Android</th> +<th>Safari on IOS</th> +<th>Samsung Internet</th> +</tr> +</thead> +<tbody><tr> +<th><code>header</code></th> +<td class="bc-supports-yes">5</td> +<td class="bc-supports-yes">12</td> +<td class="bc-supports-yes">4</td> +<td class="bc-supports-yes">9</td> +<td class="bc-supports-yes">11.1</td> +<td class="bc-supports-yes">5</td> +<td class="bc-supports-yes">4.4</td> +<td class="bc-supports-yes">18</td> +<td class="bc-supports-yes">4</td> +<td class="bc-supports-yes">11.1</td> +<td class="bc-supports-yes">4.2</td> +<td class="bc-supports-yes">1.0</td> +</tr></tbody> +</table></div> +<h2 id="see_also">See also</h2> +<div class="section-content"><ul> <li>Other section-related elements: <a href="body"><code><body></code></a>, <a href="nav"><code><nav></code></a>, <a href="article"><code><article></code></a>, <a href="aside"><code><aside></code></a>, <a href="heading_elements">h1</a>, <a href="heading_elements">h2</a>, <a href="heading_elements">h3</a>, <a href="heading_elements">h4</a>, <a href="heading_elements">h5</a>, <a href="heading_elements">h6</a>, <a href="footer"><code><footer></code></a>, <a href="section"><code><section></code></a>, <a href="address"><code><address></code></a>.</li> </ul></div><div class="_attribution"> + <p class="_attribution-p"> + © 2005–2023 MDN contributors.<br>Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.<br> + <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/header" class="_attribution-link">https://developer.mozilla.org/en-US/docs/Web/HTML/Element/header</a> + </p> +</div> |
