Text, List, Link, and Navigation Attributes
This chapter groups the attributes you use most often with text, list, and navigation-related elements.
Attributes for Headings and Text Tags
Tags often used here:
<h1>to<h6><p><abbr><blockquote><q>
Common useful attributes:
idclasstitlelangdircite
Example:
<blockquote cite="https://example.com/article">
Semantic HTML improves meaning and accessibility.
</blockquote>
Attributes for Lists
Tags:
<ul><ol><li>
Important attributes:
starton<ol>reversedon<ol>typeon<ol>valueon<li>in ordered lists
Possible type values for <ol>:
1AaIi
Example:
<ol type="A" start="2">
<li>HTML</li>
<li>CSS</li>
</ol>
Attributes for Links
Tag:
<a>
Important attributes:
hreftargetreldownloadhreflangtitle
Possible target values:
_self_blank_parent_top
Common rel values:
noopenernoreferrerexternalprevnext
Example:
<a href="guide.pdf" download="html-guide.pdf">Download Guide</a>
Attributes for Navigation
Tag:
<nav>
Useful attributes:
aria-labelidclass
Example:
<nav aria-label="Course navigation">
<a href="#intro">Intro</a>
<a href="#forms">Forms</a>
</nav>
Good Practices
- use meaningful link text
- choose
target="_blank"carefully - combine it with
rel="noopener noreferrer"for external tabs - use
aria-labelwhen navigation meaning is not obvious