HTML and CSS foundations for designers
The handful of concepts that unlock frontend.

Zander Whitehurst
10 min read
You can get a long way with AI coding tools without knowing any HTML or CSS. But at some point the agent will build something slightly wrong, and you will not know why, or how to ask for the fix. That is the moment a little foundational knowledge pays for itself many times over.
You do not need to learn all of frontend. There is a small set of concepts that unlock almost everything, and most of them map neatly onto things you already know from design tools. Here are the ones I would teach any designer first.
HTML is structure, CSS is style
HTML describes what things are. A heading, a paragraph, a button, a list. CSS describes how they look. Colour, spacing, size, position.
Keeping these separate in your head helps enormously. When something looks wrong, ask yourself whether the problem is the structure or the style. It is usually one or the other, and knowing which tells you what to ask for.
Use the right element
HTML has elements for specific jobs, and using the right one matters for accessibility, search engines and keyboard users:
<h1>Account settings</h1>
<p>Manage your profile and notifications.</p>
<button>Save changes</button>
<a href="/billing">View billing</a>
A quick rule of thumb: if it takes you somewhere, it is a link. If it does something on the page, it is a button. I once reviewed a prototype where every clickable thing was a div. It looked fine, worked with a mouse and was completely unusable with a keyboard. AI tools sometimes do this too, so it is worth checking.
Everything is a box
Every element on a page is a rectangle. Each box has content, padding around the content, a border around the padding and margin outside the border. This is called the box model.
If you have used padding and strokes in Figma, you already understand most of it. The one new idea is margin, which is space outside the element. In modern layouts you will often use gap on the parent instead, which is far easier to reason about.
Block and inline
Some elements stack vertically and take the full width, like headings and paragraphs. These are block elements. Others sit inside a line of text, like links and bold text. These are inline elements.
This explains a lot of early confusion. If you have ever wondered why padding on a link behaves strangely, it is because it is inline. Changing it to display: inline-block or making it part of a flex layout usually fixes it.
Flexbox is auto layout
Flexbox is how you lay out items in a row or a column with consistent gaps and alignment. It is the closest thing in CSS to auto layout in Figma:
.toolbar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
}
If you learn one layout tool properly, make it this one. It covers navigation bars, button groups, card contents and most of the small layouts you build every day.
Grid is for two dimensions
When you need rows and columns at the same time, like a gallery or a dashboard, CSS Grid is the right tool. It lets you define columns and let content flow into them.
You do not need to master it early. Just know it exists, so you can tell an agent "use a three column grid that collapses to one column on mobile" and recognise the result.
Units that matter
A few units come up constantly:
- px for fixed sizes like borders
- rem for type and spacing that respects the user's font size settings
- % for sizes relative to the parent
- vh and vw for sizes relative to the screen
Understanding rem is particularly useful. It is how you make interfaces that scale properly for people who increase their browser's text size.
Responsive design with media queries
Interfaces need to work at every size. Media queries let you change styles at specific widths:
@media (min-width: 768px) {
.cards { grid-template-columns: repeat(2, 1fr); }
}
Designing mobile first and adding styles as the screen gets bigger tends to produce simpler, more robust layouts.
Learn the browser inspector
The single most useful skill on this list is not a concept at all. It is right clicking on any element and choosing Inspect. You can see its HTML, its CSS and its box model, and even change values live.
I spent an embarrassing amount of my early career guessing at spacing values from screenshots. The inspector would have told me in two seconds.
Start with the inspector
Open a website you admire and inspect three elements. Look at which HTML element each one uses, find its padding and see whether it uses flexbox or grid. Change a few values and watch what happens. Do this for ten minutes a day for a week, and the agent's code will stop looking like a foreign language. For guided practice, our Frontend UI for Designers workshop covers these foundations, and the AI Design Engineering Bootcamp takes them all the way to shipping code.
Memorisely