HTML & CSS · Beginner · 15 min
Connect sections with links and lists
Create descriptive links and group related items in a list.
Link to a section
An anchor uses href to identify its destination. A fragment beginning with # refers to an element with that id in the same document. Each id must be unique. Descriptive link text tells the reader where the link goes. The preview supports these local links; external navigation is disabled.
<nav><a href="#interests">My interests</a></nav>
<section id="interests"><h2>Interests</h2></section>Expected appearance
My interests Interests
Group related items
Use <ul> when the order is not important and <ol> when sequence matters. Each item belongs in li. Lists preserve the relationship between items when styles change or a screen reader reads the page.
<ul>
<li>Drawing</li>
<li>Walking</li>
</ul>Expected appearance
Drawing Walking
Try it yourself
Code runs on this device. When you are signed in, drafts sync to your account.
Edit the page content and include CSS in a style element. The preview supports a limited set of HTML elements. Scripts, external resources, navigation to other sites, and form submission are disabled.
Build and check
Add a link inside <nav> with href="#interests" and the text My interests. Add a section with id="interests" containing an <h2> and a <ul> with two <li> items.
The href fragment and section id must match. Put both <li> elements inside ul.
Show worked solution
<nav><a href="#interests">My interests</a></nav>
<section id="interests">
<h2>Interests</h2>
<ul><li>Drawing</li><li>Walking</li></ul>
</section>The href fragment and section id must match. Put both <li> elements inside ul.
Page preview
Run to preview your page. Check tests the task requirements, including the requested screen widths. Check results do not replace keyboard and visual review.
Try it yourself
- Use the link to reach the interests section.
- Replace the interests with two activities you enjoy.