Lesson 2 of 5 · 5 min
Text, lists and links
Headings and their outline, paragraphs and inline text, ordered and unordered lists, and links to other pages, sections, email and files.
On this page
Headings
HTML has six heading levels, h1 to h6:
<h1>CSS Fundamentals</h1>
<h2>The box model</h2>
<h3>Margin collapse</h3>
Headings form an outline of the page. Screen reader users jump between them to navigate, and search engines use them to understand the content. Follow two rules:
- One
h1per page, describing the whole page. - Don't skip levels. An
h3should sit under anh2, not straight under theh1.
Choose a heading level for its place in the outline, never for its size. Size is CSS's job.
Paragraphs and inline text
<p>A paragraph is a block of text.</p>
<p>
Use <strong>strong</strong> for importance and <em>em</em> for stress.
Use <code>code</code> for code, and <kbd>Ctrl</kbd> + <kbd>C</kbd> for keys.
<mark>Highlight</mark> a match, and write dates as
<time datetime="2026-11-22">22 November 2026</time>.
</p>
<b> and <i> only change the look. <strong> and <em> add meaning that assistive technology can announce, so prefer them.
Lists
An unordered list, where order doesn't matter:
<ul>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ul>
An ordered list, for steps:
<ol>
<li>Write the HTML</li>
<li>Add the CSS</li>
<li>Test on a phone</li>
</ol>
Lists can nest: put a whole <ul> inside an <li>. Navigation menus are usually lists of links, too.
Links
The anchor element, <a>, makes a link. Its href says where it goes:
<a href="https://developer.mozilla.org">MDN Web Docs</a> <!-- another site -->
<a href="/courses/css">CSS course</a> <!-- a page on this site -->
<a href="#forms">Jump to forms</a> <!-- a section on this page -->
<a href="mailto:hello@example.com">Email me</a> <!-- opens the mail app -->
<a href="/resume.pdf" download>Download my resume</a> <!-- downloads a file -->
To link to a section, give its heading an id:
<h2 id="forms">Forms</h2>
Opening in a new tab
<a href="https://github.com" target="_blank" rel="noopener noreferrer">GitHub</a>
Use new tabs sparingly; people can choose to open one themselves. When you do, add rel="noopener noreferrer" so the new page can't control yours.
Write useful link text
Link text should make sense on its own, because screen reader users often list all the links on a page.
<!-- Unclear -->
To read the guide, <a href="/guide">click here</a>.
<!-- Clear -->
Read the <a href="/guide">setup guide</a>.
Quotes and code blocks
<blockquote cite="https://example.com/source">
<p>Simplicity is prerequisite for reliability.</p>
</blockquote>
<pre><code>function hello() {
return "world";
}</code></pre>
<pre> keeps whitespace and line breaks exactly as written, which is what code needs.
Try it
Build a page about something you know well. Give it one h1, at least two h2 sections, a list, a link to another website, and a "Back to top" link that jumps to an id on the h1.
More from HTML Crash Course
- Lesson 4 · 5 minFormsCollect input with labels, the right input types, built-in validation, grouped options and buttons, and send it to a server.
- Lesson 5 · 5 minSemantic HTML and accessibilityLandmarks like header, nav, main and footer, articles and sections, tables for data, and a short checklist for accessible, search-friendly pages.