Build your own developer portfolio in plain HTML and CSS, with a light and dark theme, a projects grid, a labelled contact form, gentle motion and a deploy.
32 min read0/5 questions
Every developer needs a home on the web: one page that says who you are, shows what you have built and makes it easy to get in touch. Recruiters and hiring managers often look at it before they read your CV in detail, so a clean, fast, accessible portfolio quietly proves the skills you claim. In this project you will build one for Jordan Rivera, a made-up junior developer, using only HTML and CSS. Swap in your own name and projects as you go. Unlike the landing page project, this page has a theme that follows the visitor's system setting, a real contact form and motion that respects people who turn animation off.
Step 1: Plan the page
A portfolio has one job: help a busy reader decide in under a minute whether to contact you. Write the content before any code. Keep it to four sections:
Hero: your name, what you do in one line, and two links (see projects, get in touch).
Projects: three to six of your best pieces, each with a title, one sentence, the tools used and links to the live site and code.
About: a short paragraph in your own voice and a list of skills.
Contact: a small form plus a plain email link as a backup.
Three good projects beat ten tutorials. For each one, write what problem it solves and one thing you learned. That sentence is what a reader remembers.
The portfolio project
portfolio/
index.htmlthe whole page
styles.csstokens, layout, components
images/
recipe-app.webpproject screenshots
budget-tracker.webp
cv.pdfoptional download
favicon.svg
Step 2: The semantic skeleton
Start with HTML only. Landmarks and a clean heading outline make the page usable for screen readers before a single style exists. The skip link at the top lets keyboard users jump past the navigation.
HTML & CSSEdit the code, the preview updates live
12345678910111213141516171819202122232425262728
<a href="#main">Skip to content</a><header> <a href="#top">Jordan Rivera</a> <nav aria-label="Main"> <ul> <li><a href="#projects">Projects</a></li> <li><a href="#about">About</a></li> <li><a href="#contact">Contact</a></li> </ul> </nav></header><main id="main"> <section id="top"> <h1>Jordan Rivera</h1> <p>Front-end developer who builds fast, accessible websites.</p> </section> <section id="projects" aria-labelledby="projects-title"> <h2 id="projects-title">Projects</h2> <article><h3>Crumb</h3><p>A recipe finder that works offline.</p></article> </section> <section id="about" aria-labelledby="about-title"> <h2 id="about-title">About</h2> </section> <section id="contact" aria-labelledby="contact-title"> <h2 id="contact-title">Contact</h2> </section></main><footer><p>Built by hand with HTML and CSS.</p></footer>
Preview
Each project is an article because it makes sense on its own, like a card you could lift out and put somewhere else. The aria-labelledby on each section gives it an accessible name taken from its heading, so a screen reader's landmark list shows "Projects, region" instead of an unnamed section.
The portfolio as a tree
Step 3: Tokens for a light and dark theme
Put every colour in custom properties first. Then a single media query, prefers-color-scheme: dark, swaps the values when the visitor's system is set to dark mode. No rule further down needs to know which theme is active, because every rule reads the variables.
The preview follows your computer's setting. To see the other theme without changing your system, open Chrome devtools, press the three-dot menu, choose More tools then Rendering, and set Emulate CSS media feature prefers-color-scheme to dark or light. Firefox and Safari have similar options in their inspectors.
color-scheme: light dark tells the browser the page supports both themes, so built-in pieces like scrollbars and form fields switch to matching colours too. Notice the accent is a darker indigo in light mode and a lighter one in dark mode: the same colour rarely has enough contrast on both backgrounds.
Quick check
Your dark theme works for text and backgrounds, but the form inputs and scrollbars stay bright white. What is the most likely missing piece?
Need a nudge? A hint rules out a wrong answer.
Step 4: The hero
The hero is the first thing anyone sees. Make the name big, the one-liner clear and the two actions obvious. One primary button-style link and one quieter link is a common pattern: it tells the reader which action you would like most.
clamp() makes the heading fluid, max-width: 38ch keeps the lead at a readable length, and the actions are a wrapping Flexbox row so the buttons stack neatly on a narrow phone. Rewrite the heading for yourself; keep it to one sentence.
Step 5: The projects grid
This is the heart of the page. Use the auto-fit grid from the common layouts lesson for the cards, and make each card a flex column so the links line up at the bottom whatever the description length.
Notice the screen reader detail on the first card. Several links all saying "Live site" are confusing when a screen reader lists every link on the page out of context. A visually hidden span adds "for Crumb" to the link's name without changing what sighted users see. The .sr-only rule shrinks it to a 1 pixel box and clips it, while keeping it in the accessibility tree (display: none would hide it from screen readers too). Delete the .sr-only rule to see the hidden words appear, then repeat the pattern for the other cards.
In a real portfolio, add a screenshot to each card with <img src="images/crumb.webp" alt="" width="640" height="400" loading="lazy">. The alt can be empty when the card's heading and text already describe the project; the image is then decoration. Setting width and height stops the layout jumping while it loads.
Match the pairs0/5 matched
Match each part of a project card to its purpose.
Choose an item, then its match on the other side.
Step 6: About and contact
The about section is plain text plus a skills list; keep it short and human. The contact form deserves more care, because forms are where accessibility most often breaks. Every input needs a visible label connected with for and id, the right type so phones show the right keyboard, autocomplete hints so browsers can fill them in, and required where a field is mandatory.
Click Send message with empty fields and the browser's built-in validation stops you and points at the first problem. Type an address without an @ to see the email check. Click a label and its field gets focus, which is the quick test that for and id match. aria-describedby links the hint to the email field, so a screen reader reads it when the field gets focus.
A static site has no server to receive the form. Your options are a form backend service (you point the form's action at an address the service gives you, and it emails you the messages), a serverless function on your host, or simply a mailto: link. Many portfolios offer both a form and a plain email address. The tiny script here only exists so the demo does not try to navigate away.
Quick check
A tester says clicking the word Email does not put the cursor in the email box. What is the bug?
Need a nudge? A hint rules out a wrong answer.
Step 7: Motion that respects the reader
Small hover effects make a page feel alive. Keep them short (150 to 250 milliseconds) and animate only transform and opacity, which the browser can do smoothly without recalculating layout. Then switch motion off for people who ask their system to reduce it: for some readers, movement causes dizziness or nausea.
Shadows are not one of the cheap properties, but a short shadow fade on a handful of cards is fine in practice. The reduced-motion block is a widely used catch-all: it does not remove the hover styles, it just makes them change instantly. The finished page below includes both, plus scroll-behavior: smooth for the nav links, which the same block turns off.
Predict the outputHTML & CSS
A visitor has reduced motion turned on and hovers a project card. Roughly how long, in milliseconds, does the card take to move up?
Thanks to auto-fit, flex wrapping and clamp(), most of this page is responsive without breakpoints. You only need media queries for changes in structure. Here, from 48rem the about section becomes two columns (text beside skills), and the header keeps the name and nav on one line while it can. Test in devtools device mode at 360, 768 and 1280 pixels wide: look for overflowing text, tap targets smaller than about 44 by 44 pixels, and line lengths over about 75 characters.
The finished page
Here is everything together. The preview is narrow, so you will see the phone layout; widen your browser and open it on a real page to see the desktop version. Then make it yours.
Press Tab once inside the preview and the skip link slides into view. Tab on through the page and every link, field and button shows a clear outline. Scroll and the header stays put; it has a solid background so text does not show through.
Step 9: Accessibility checklist
Go through this before you share the link. A portfolio with broken basics undermines the very skills it is meant to show.
lang="en" on html, a descriptive title ("Jordan Rivera, front-end developer") and the viewport meta tag.
A skip link, landmarks, one h1, headings in order.
Every form control has a visible, connected label; hints are linked with aria-describedby.
Link text makes sense out of context ("Code for Crumb", not "click here").
Focus is visible on everything you can Tab to, in both themes.
Text contrast at least 4.5 to 1 in both themes. Check the accent colour on both backgrounds separately.
Motion turns off with prefers-reduced-motion.
Images have sensible alt (empty when decorative) plus width and height.
Then run Lighthouse in Chrome devtools, and try the page with your screen reader for five minutes (VoiceOver on a Mac, NVDA on Windows). Automated tools catch only part of the problems.
Put it in order7 steps
Put the portfolio build steps in the order this project used.
Tap the steps below in the right order.
Need a nudge? A hint shows where it starts.
Step 10: Deploy it
The page is static files, so host it the same way as the landing page: push the folder to a GitHub repository, then turn on GitHub Pages in the repository's settings, or connect the repository to Netlify, Vercel or Cloudflare Pages. Every push updates the live site.
A portfolio deserves a few extras. Buy a domain with your name if you can; it looks professional and stays yours when you change hosts. Add the link to your CV, GitHub profile and LinkedIn. Add an og:title, og:description and og:image in the head (from the head and SEO lesson) so the link shows a nice preview card when shared. Finally, open the live page on your own phone, on mobile data, and fix whatever feels slow or awkward.
Key terms
portfolio
A personal site that shows who you are, what you have built and how to contact you.
prefers-color-scheme
A media feature that matches when the visitor's system is set to light or dark mode.
color-scheme
A CSS property telling the browser which themes the page supports, so built-in controls match.
skip link
A link at the very top that lets keyboard users jump straight to the main content.
visually hidden text
Text hidden on screen with an sr-only class but still read by screen readers.
prefers-reduced-motion
A media feature that matches when the visitor has asked their system to reduce animation.
form backend service
A hosted service that receives a static site's form submissions and forwards them to you.