HTML & CSS · Beginner · 15 min
Make text easy to read
Set readable text spacing and preserve visible link cues.
Let text breathe
A unitless line-height scales with the element’s font size. A value of 1.5 provides space between lines in this exercise. Use a sensible maximum line length for paragraphs. Relative font sizes allow the page to respond to a reader’s settings.
<style>
.intro { font-size: 1rem; line-height: 1.5; max-width: 60ch; }
</style>
<p class="intro">I am learning to build clear, useful pages.</p>Expected appearance
font-size: 16px line-height: 24px
Keep contrast and focus visible
Choose foreground and background colors with enough contrast. Color alone should not identify a link; keep its underline. Keyboard users need a visible focus indicator. These checks cover selected properties only, so also inspect the page and test it with the keyboard.
<style>
.intro { color: #1f2937; background-color: #ffffff; }
a { text-decoration: underline; }
a:focus-visible { outline: 3px solid navy; outline-offset: 3px; }
</style>
<p class="intro">Read <a href="#about">about me</a>.</p>
<section id="about"><h2>About me</h2></section>Expected appearance
color: rgb(31, 41, 55) background-color: rgb(255, 255, 255)
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
Style p.intro with font-size: 20px, line-height: 1.5, color: #1f2937, and background-color: #ffffff. Keep its link underlined.
Use a unitless 1.5 for line-height. The browser computes 30px for the specified 20px font size.
Show worked solution
<style>
.intro { font-size: 20px; line-height: 1.5; color: #1f2937; background-color: #ffffff; }
a { text-decoration: underline; }
a:focus-visible { outline: 3px solid navy; outline-offset: 3px; }
</style>
<p class="intro">Read <a href="#about">about me</a>.</p>
<section id="about"><h2>About me</h2></section>Use a unitless 1.5 for line-height. The browser computes 30px for the specified 20px font size.
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 Tab to focus the link and look for its outline.
- Increase browser zoom and confirm the paragraph remains readable.