<h1>â<h6>ï¼HTML åºåæ é¢å ç´
åºçº¿
广æ³å¯ç¨
èª 2015å¹´7æ èµ·ï¼æ¤ç¹æ§å·²å¨ä¸»æµæµè§å¨ä¸å¾å°æ¯æï¼å¯å¨å¤§å¤æ°è®¾å¤åæµè§å¨çæ¬ä¸æ£å¸¸ä½¿ç¨ã
HTML <h1>â<h6> æ é¢ (Heading) å
ç´ åç°äºå
个ä¸åç级å«çæ é¢ï¼<h1> çº§å«æé«ï¼è <h6> çº§å«æä½ã
å°è¯ä¸ä¸
<h1>Beetles</h1>
<h2>External morphology</h2>
<h3>Head</h3>
<h4>Mouthparts</h4>
<h3>Thorax</h3>
<h4>Prothorax</h4>
<h4>Pterothorax</h4>
h1,
h2,
h3,
h4 {
margin: 0.1rem 0;
}
h1 {
font-size: 2rem;
}
h2 {
font-size: 1.5rem;
padding-left: 20px;
}
h3 {
font-size: 1.2rem;
padding-left: 40px;
}
h4 {
font-size: 1rem;
font-style: italic;
padding-left: 60px;
}
| å å®¹ç±»å« | æµå¼å å®¹ï¼æ é¢å 容ï¼å¯è§¦ç¥çå 容ã |
|---|---|
| å 许å 容 | çè¯å 容 |
| æ ç¾çç¥ | ä¸å 许ï¼å¼å§æ ç¾åç»ææ ç¾é½ä¸è½çç¥ã |
| å 许çç¶å ç´ | 任使¥åæµå
容çå
ç´ ï¼ä¸è¦æå®ä½ä¸º <hgroup> å
ç´ çåå
ç´ ï¼è¿ç§åæ³å·²ç»è¢«åºå¼äºã |
| å 许ç ARIA roles | tab, presentation |
| DOM æ¥å£ | HTMLHeadingElement |
屿§
该å ç´ å 嫿æå ¨å±ç¹æ§ã
夿³¨ï¼align 屿§å·²åºå¼ï¼ä¸è¦ç»§ç»ä½¿ç¨å®ã
使ç¨è¦ç¹
示ä¾
>æææ é¢
ä¸é¢ç代ç å±ç¤ºäºææå¯ç¨çæ é¢çº§å«ã
<h1>ä¸çº§æ é¢</h1>
<h2>äºçº§æ é¢</h2>
<h3>ä¸çº§æ é¢</h3>
<h4>å级æ é¢</h4>
<h5>äºçº§æ é¢</h5>
<h6>å
级æ é¢</h6>
ä¸é¢æ¯è¿äºä»£ç çç»æï¼
示ä¾é¡µé¢
ä¸é¢ç代ç å±ç¤ºäºå ä¸ªå ·æé¨åå å®¹çæ é¢ã
<h1>Heading elements</h1>
<h2>Summary</h2>
<p>Some text here...</p>
<h2>Examples</h2>
<h3>Example 1</h3>
<p>Some text here...</p>
<h3>Example 2</h3>
<p>Some text here...</p>
<h2>See also</h2>
<p>Some text here...</p>
ä¸é¢æ¯ä»£ç çè¿è¡ç»æï¼
æ éç¢é®é¢
>导èª
对äºä½¿ç¨å±å¹é 读软件çç¨æ·èè¨ï¼ä¸ç§å¸¸è§çå¯¼èªæ¹å¼æ¯ä»ä¸ä¸ªæ é¢è·³å°å¦ä¸ä¸ªæ é¢ï¼ä»¥å¿«éç¡®å®é¡µé¢çå 容ãå æ¤ï¼ä¸è¦è·³è¿ä¸ä¸ªæå¤ä¸ªæ é¢çº§å«ãå ä¸ºè¿æ ·åå¯è½ä¼é ææ··ä¹±ï¼ä½¿ç¨æ·å°æäºç¼ºå°çæ é¢å¨åªéã
éè¯¯ç¨æ³
<h1>Heading level 1</h1>
<h3>Heading level 3</h3>
<h4>Heading level 4</h4>
æ£ç¡®ç¨æ³
<h1>Heading level 1</h1>
<h2>Heading level 2</h2>
<h3>Heading level 3</h3>
åµå¥
æ é¢å¯ä»¥åµå¥å ¶å°èï¼ä»¥åæ 页é¢çç»æã大夿°å±å¹é 读å¨å¯ä»¥çæé¡µé¢ä¸æææ é¢çå表ï¼ä»è帮å©ç¨æ·å¿«éç¡®å®å 容ç屿¬¡ç»æï¼
h1Beetles-
h2Etymology -
h2Distribution and Diversity -
h2Evolutionh3Late Paleozoich3Jurassich3Cretaceoush3Cenozoic
-
h2External Morphology-
h3Headh4Mouthparts
-
h3Thoraxh4Prothoraxh4Pterothorax
-
h3Legs -
h3Wings -
h3Abdomen
-
-
å½å°èä¸åµå¥åæ 颿¶ï¼è¥å ³éäºæä¸ªå°èï¼åå ¶ä¸çåµå¥çåæ é¢å¯è½ä¼è¢«âè·³è¿âã
- Headings ⢠Page Structure ⢠WAI Web Accessibility Tutorials
- MDN Understanding WCAG, Guideline 1.3 explanations
- Understanding Success Criterion 1.3.1 | W3C Understanding WCAG 2.0
- MDN Understanding WCAG, Guideline 2.4 explanations
- Understanding Success Criterion 2.4.1 | W3C Understanding WCAG 2.0
- Understanding Success Criterion 2.4.6 | W3C Understanding WCAG 2.0
- Understanding Success Criterion 2.4.10 | W3C Understanding WCAG 2.0
æ æ³¨ç« èå 容
å±å¹é è¯»è½¯ä»¶ç¨æ·çå¦ä¸ç§å¸¸ç¨å¯¼èªææ¯æ¯çæå 容ååºçå表ï¼å¹¶ä½¿ç¨å ¶ç¡®å®é¡µé¢å¸å±
Sectioning content can be labeled using a combination of the aria-labelledby and id attributes, with the label concisely describing the purpose of the section. This technique is useful for situations where there is more than one sectioning element on the same page.
示ä¾
<header>
<nav aria-labelledby="primary-navigation">
<h2 id="primary-navigation">Primary navigation</h2>
<!-- navigation items -->
</nav>
</header>
<!-- page content -->
<footer>
<nav aria-labelledby="footer-navigation">
<h2 id="footer-navigation">Footer navigation</h2>
<!-- navigation items -->
</nav>
</footer>
In this example, screen reading technology would announce that there are two <nav> sections, one called "Primary navigation" and one called "Footer navigation". If labels were not provided, the person using screen reading software may have to investigate each nav element's contents to determine their purpose.
è§è
| è§è |
|---|
| HTML > # the-h1,-h2,-h3,-h4,-h5,-and-h6-elements > |