HTML & CSS · Beginner · 25 min
Project: your personal page
Combine semantic HTML and responsive CSS in a small personal page.
Plan the content first
Decide what the page should tell its reader. Give it one main heading, an introduction, and two interests. Use <header>, <nav>, <main>, section, article, and <footer> where their meanings fit. Add a local navigation link that names its destination clearly.
<header><h1>Sam’s learning page</h1></header>
<main>
<section id="about"><h2>About me</h2><p>I enjoy drawing.</p></section>
</main>Expected appearance
Sam’s learning page About me I enjoy drawing.
Check the result in more than one way
Build a layout with one column first, then add a second column for the interest cards on wider screens. Use the automated checks for the stated requirements. Also test keyboard focus, zoom, readable text, and narrow layouts. Passing these selected checks is not a complete accessibility audit.
<style>
.cards { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 600px) { .cards { grid-template-columns: 1fr 1fr; } }
a:focus-visible { outline: 3px solid navy; }
</style>Expected appearance
320px: 1 768px: 2
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
Create a <header> containing one <h1> and a <nav> with a link to #about. Add one <main> containing section#about with an <h2> and a paragraph. Add a <footer> containing a paragraph. Add .cards with two direct article children, each containing an <h3> and a paragraph. Use one grid column at 320px and two at 768px, with a 16px gap. Make <main> fit the viewport using border-box sizing, width: 100%, max-width: 720px, and 16px padding. Use color: #1f2937 on a white <main> background. Keep the navigation link underlined and give it a 3px solid navy keyboard focus outline. Choose your own page text.
Use the patterns from the earlier lessons. Build the structure first, then add CSS in a <style> element. Test narrow and wide layouts.
Show worked solution
<style>
* { box-sizing: border-box; }
main { width: 100%; max-width: 720px; margin: 0 auto; padding: 16px; color: #1f2937; background-color: #ffffff; }
.cards { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .cards { grid-template-columns: 1fr 1fr; } }
a { text-decoration: underline; }
a:focus-visible { outline: 3px solid navy; outline-offset: 3px; }
</style>
<header><h1>Sam’s learning page</h1><nav><a href="#about">About me</a></nav></header>
<main>
<section id="about"><h2>About me</h2><p>I enjoy drawing and learning new skills.</p></section>
<section><h2>My interests</h2><div class="cards"><article><h3>Drawing</h3><p>I draw places I visit.</p></article><article><h3>Walking</h3><p>I explore local parks.</p></article></div></section>
</main>
<footer><p>Built while learning HTML and CSS.</p></footer>Use the patterns from the earlier lessons. Build the structure first, then add CSS in a <style> element. Test narrow and wide layouts.
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
- Build the page without copying the full worked solution.
- Use Tab to check the navigation link, zoom in, and compare narrow and wide layouts.
- Replace the sample text with your own introduction. Review the code and explain your layout choices.