A complete responsive portfolio page needs four things in place: a semantic document outline, a stylesheet split into predictable layers, a small number of deliberate breakpoints, and accessibility decisions written down rather than left to chance.
The previous lesson in this module covered "How Is a Real Landing Page Assembled Step by Step?", and this lesson is the last one in the HTML and CSS Projects module.
What should the document outline look like?
A portfolio has one job for each visitor and three kinds of visitor: someone looking for work, someone reading about you, and someone wanting to contact you. The document should let all three find their section without guessing.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Jordan Blake — Front-end developer</title>
<link rel="stylesheet" href="/styles/portfolio.css">
</head>
<body>
<a class="skip-link" href="#main">Skip to content</a>
<header class="site-header">
<p class="brand">Jordan Blake</p>
<nav aria-label="Primary">
<a href="#work">Work</a><a href="#about">About</a><a href="#contact">Contact</a>
</nav>
</header>
<main id="main">
<section class="intro" aria-labelledby="intro-title">
<h1 id="intro-title">Front-end developer building fast, accessible interfaces</h1>
<p>I work with small product teams to turn designs into interfaces that load fast and behave predictably on every screen.</p>
<a class="button" href="#contact">Get in touch</a>
</section>
<section class="work" id="work" aria-labelledby="work-title">
<h2 id="work-title">Selected work</h2>
<ul class="work-list">
<li class="work-card">
<img src="projects/tide.jpg" alt="Tide booking screen on a phone" width="640" height="480">
<h3>Tide</h3><p>Rebuilt a booking flow that was hard to complete on a small screen.</p>
</li>
<li class="work-card">
<img src="projects/atlas.jpg" alt="Atlas logistics dashboard with a map" width="640" height="480">
<h3>Atlas</h3><p>A dashboard that stays usable from a phone in a warehouse.</p>
</li>
</ul>
</section>
<section class="about" id="about" aria-labelledby="about-title">
<h2 id="about-title">About</h2>
<p>I write front-end code for teams that ship every week, and I care more about the second year of a project than the first.</p>
</section>
<section class="contact" id="contact" aria-labelledby="contact-title">
<h2 id="contact-title">Contact</h2>
<p><a href="mailto:[email protected]">[email protected]</a></p>
</section>
</main>
<footer class="site-footer"><p>Built by hand with HTML and CSS.</p></footer>
</body>
</html>
Read that outline as a screen reader would. The skip link is the first focusable element, so a keyboard user can jump past the header in one keystroke. The header, main region and footer are three landmarks, and each of the four sections inside main is a region with a name, because every one of them points its aria-labelledby at its own heading. The heading levels run from one to two to three with no gaps, and the page has exactly one first-level heading.
How should the stylesheet be organised?
Even a single-page portfolio benefits from the layered approach. The tokens and base rules define the vocabulary, the layout rules place the sections, and the component rules style the recurring pieces such as the card and the button.
:root {
--ink: #0f172a;
--muted: #475569;
--paper: #ffffff;
--accent: #1d4ed8;
--line: #e2e8f0;
--space: 1rem;
}
* { box-sizing: border-box; }
body {
margin: 0;
font-family: system-ui, sans-serif;
line-height: 1.6;
color: var(--ink);
background: var(--paper);
}
img {
display: block;
max-inline-size: 100%;
height: auto;
}
Two of those declarations are doing more work than they look. box-sizing: border-box means a width you set includes the padding and the border, so adding padding to the cards later does not silently widen them. And the image rule with height: auto means the intrinsic ratio from the width and height attributes is preserved, so the images never distort and the space is reserved before they load.
.site-header,
main,
.site-footer {
max-inline-size: 72rem;
margin-inline: auto;
padding-inline: 1.25rem;
}
.site-header {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
gap: 1rem;
padding-block: 1.25rem;
}
.intro {
max-inline-size: 44rem;
padding-block: 4rem 3rem;
}
.work-list {
display: grid;
gap: 2rem;
margin: 0;
padding: 0;
list-style: none;
}
.button {
display: inline-block;
padding: 0.75rem 1.25rem;
border-radius: 999px;
background: var(--accent);
color: #ffffff;
font-weight: 600;
text-decoration: none;
}
Which breakpoints does the page actually need?
A portfolio has very little that changes between screen sizes, so it needs very few breakpoints. Each one should be added because something stops working, not because a device exists.
| Width | What changes | Why |
|---|---|---|
| Below 44rem | Work items stack in one column, the header wraps | Two columns of images stop being readable |
| 44rem and up | Work items sit side by side | Each project still gets a readable width |
| 64rem and up | The intro gains more space above it | Content sits lower on a wide screen |
| Any width | Nothing | Text size and measure stay constant for readability |
@media (min-width: 44rem) {
.work-list { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 64rem) {
.intro { padding-block: 6rem 4rem; }
}
The layout is written to work without either query. The narrow version is not a degraded version, it is the version that most visitors see first, so it gets the full attention in the design.
Which accessibility decisions are worth writing down?
Five of them carry most of the value, and each one costs a couple of lines.
- A skip link, so the header does not have to be tabbed through on every page.
- A visible focus ring, drawn with
:focus-visibleso it appears for keyboard use without adding a stray outline to mouse clicks. - Honest alternative text on the project images, describing what the screen shows rather than repeating the project name.
- A colour scheme that respects the reader's motion preference, so a page that scrolls smoothly does not force that behaviour on someone who has asked for less movement.
- A readable measure, so no line of text runs the full width of a wide screen.
.skip-link {
position: absolute;
inset-block-start: 0;
inset-inline-start: 0;
padding: 0.5rem 1rem;
background: var(--ink);
color: #ffffff;
transform: translateY(-120%);
}
.skip-link:focus {
transform: translateY(0);
}
:focus-visible {
outline: 3px solid var(--accent);
outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
html { scroll-behavior: auto; }
*, *::before, *::after {
animation-duration: 0.01ms !important;
transition-duration: 0.01ms !important;
}
}
The skip link is moved out of sight with a transform rather than a large negative offset, because a transform does not create a scrollable area, and a negative offset can leave a strip of page that scrolls when it should not. When the link receives focus the transform is undone and the link appears at the top of the page, ready to be followed.
What does the head of the document need?
A portfolio is a page people find through a search engine or a shared link, so the head carries more than the stylesheet link. The lang attribute on the html element tells screen readers which pronunciation rules to use for the whole document. The title element is the name of the page in the browser tab and the headline of the search result. The viewport meta tag is what lets the page respond to the width of a phone instead of being shown at a fixed desktop width and scaled down.
<meta name="description" content="Portfolio of Jordan Blake, a front-end developer building fast and accessible interfaces.">
<meta property="og:title" content="Jordan Blake — Front-end developer">
<meta property="og:description" content="Selected front-end work and a way to get in touch.">
<meta property="og:image" content="/images/portfolio-card.png">
<meta property="og:type" content="website">
The Open Graph entries control what a shared link shows on a messaging app or a social network, which for a portfolio is often the first impression anyone gets. Keep the description short enough that it is not truncated mid-sentence, and point the image at a real file rather than a placeholder, because a missing image is the failure that looks worst in a preview.
Cheat sheet
- One first-level heading, and it states what you do.
- Landmarks for the header, the main region, the footer and every named section.
- Tokens and base rules first, then layout, then components.
- Set
box-sizing: border-boxonce and stop thinking about it. - Give every image a width and a height so the layout does not jump.
- Add a breakpoint only when something breaks, and make the narrow layout the default.
- Ship a skip link, a focus ring, honest alt text and a motion preference.
- Keep the reading measure under about seventy characters.
Try it yourself: build the portfolio page above as a single file with the styles in a linked stylesheet, then open it with the keyboard only. Tab from the top and confirm the skip link appears first and moves focus into the main region. Narrow the window to phone width and check that the work items stack and the header wraps without anything overlapping. Finally, set the operating system to reduce motion, add a smooth scroll to the anchor links, and confirm the preference is respected.