Lesson 2 of 13 Β· 8 min Β· 2 hands-on steps
Text, Links & Images
Headings, paragraphs, bold text, links to other pages, and images with alt text.
Text elements
<h1>Main title (one per page)</h1>
<h2>Section heading</h2>
<h3>Sub-section</h3>
<p>A paragraph with <strong>important</strong> and <em>emphasized</em> words.</p>
<br /> <!-- a line break -->
<hr /> <!-- a horizontal divider -->
Headings go in order (h1 β h2 β h3) like an outline. Screen readers and Google use them to understand your page.
Links
<a href="https://wikipedia.org">Visit Wikipedia</a>
<a href="/about">About us</a> <!-- a page on the same site -->
<a href="#contact">Jump to contact</a> <!-- a spot on the same page -->
Write link text that makes sense on its own: "Read the docs" beats "click here".
Images
<img src="photo.jpg" alt="Two friends laughing at a cafΓ©" width="300" />
src: where the image file isalt: a description for people who can't see it (and for Google). Describe what matters in the image.
Try it
Use the Playground β HTML / CSS / JS tab to experiment freely. Every change shows instantly in the preview. Then do the practice steps below.
π§ͺ Practice: 2 steps
0 / 2 doneStep 1 of 2 Β· A heading hierarchy
Create an <h1> that says My Recipes, an <h2> that says Pancakes, and a <p> underneath with any description that contains a bold word (use <strong>).
Output appears here. Press Run or Ctrl/β + Enter.
Step 2 of 2 Β· Link and image
Add a link <a> with the text Watch the video that points to https://example.com/pancakes, and an <img> with src="https://picsum.photos/200" and a meaningful alt description.
Output appears here. Press Run or Ctrl/β + Enter.
β Check your understanding
Why does every image need alt text?
How many h1 headings should a page usually have?
Create a free account to track your progress.