HTML and CSS
Markup and styling as the platform defines them: semantic HTML, forms, the cascade, and layout. Interviews use them to separate engineers who understand layout from those who adjust values until it looks right.- 9
- chapters
- 61
- questions
- 19
- core
- 1083
- flashcards
- Covers Chrome 155–156 and Firefox 158–159 on macOS; Safari from compat data only
- 61 not yet reviewed
- Last verified October 2026
01Documents and semantics7 questions
What an HTML document is before any CSS touches it: the doctype and rendering modes, the content model the parser enforces, semantic elements and landmarks, and the metadata in<head>.- What does
<!DOCTYPE html>do, and what are quirks and standards modes? - What is HTML's content model, and what happens when you put a
<div>inside a<p>? - Why use semantic HTML, and when is a
divthe right element? - How do landmarks and headings structure a page now that the outline algorithm is gone?
- What belongs in
<head>, and what docharset,viewport, and<base>change? - What do link types like
canonical,noopener, andnofollowdo? - How do
data-*,hidden, and other global and boolean attributes behave?
- What does
02Forms, dialog, and popover7 questions
The interactive parts of HTML that work without JavaScript: form submission and validation, button behaviour, and the<dialog>,popover, and<details>primitives.- What happens when a form is submitted — what is sent, and how?
- How do input types,
inputmode, andautocompleteshape what the user gets? - Why does a
<button>inside a form submit it, and how do you control which form and action it uses? - How does native constraint validation work, and how do you customise it?
- How does
<dialog>work —show()vsshowModal(), closing, and the return value? - What does the
popoverattribute give you, and how is it different from<dialog>? - How do
<details>and<summary>work, including exclusive accordions?
03The cascade6 questions
How CSS decides which declaration applies: the cascade's sort order, specificity, layers,!important, inheritance, and the stages a value passes through.- How does the cascade decide which declaration wins?
- How is specificity calculated, including
:is(),:where(), and:not()? - What are cascade layers, and how do they change what overrides what?
- What does
!importantreally do, and why does it reverse origin and layer order? - Which properties inherit, and what do
inherit,initial,unset,revert, andrevert-layerdo? - What are specified, computed, used, and resolved values?
04Box model and formatting contexts8 questions
How CSS turns elements into boxes and lays them out in normal flow: the box model, display types, block and inline formatting, margin collapsing, overflow, floats, and intrinsic sizes.- Explain the CSS box model and what
box-sizing: border-boxchanges. - What does
displayactually set — outer and inner display types? - What is a block formatting context, and what creates one?
- When do vertical margins collapse, and how do you stop it?
- How are inline boxes laid out — line boxes,
line-height, andvertical-align? - What does
overflowdo, and how isoverflow: clipdifferent fromhidden? - How do floats and
clearwork, and where are they still the right tool? - What are
min-content,max-content, andfit-content?
- Explain the CSS box model and what
05Flexbox and grid7 questions
The two layout modes most interviews probe: how flexbox distributes space along a line, how grid sizes tracks and places items, and the alignment model they share.- When do you reach for flexbox, and when for grid?
- How does flexbox size items —
flex-grow,flex-shrink, andflex-basis? - Why won't a flex or grid item shrink below its content, and what does
min-width: 0fix? - How do
justify-*,align-*, andplace-*work in flexbox and grid? - How do grid tracks size —
fr,minmax(), andauto-fillvsauto-fit? - How do you place items on a grid — lines, named areas, and auto-placement?
- What problem does
subgridsolve?
06Positioning and stacking6 questions
Taking boxes out of flow and painting them in the right order: positioning schemes and containing blocks, sticky positioning, stacking contexts, the top layer, and anchor positioning.- How do
positionvalues differ, and what is each one's containing block? - How does
position: stickywork, and why does it sometimes not stick? - What is a stacking context, and why doesn't
z-index: 9999always win? - Why does a
transformon an ancestor breakposition: fixed? - What is the top layer, and how do dialogs and popovers escape
z-indexandoverflow? - How does CSS anchor positioning work?
- How do
07Responsive design6 questions
Layouts that adapt to their space: intrinsic layout first, then media queries, container queries, relative and viewport units, and fluid sizing with comparison functions.- How do you build a responsive layout, and how much should depend on breakpoints?
- How do media queries work, including range syntax and
prefers-*features? - What are container queries, and how do you establish a container?
- What are
em,rem,%, andchrelative to, and when do you use each? - What's the difference between
vh,svh,lvh, anddvh? - How do
clamp(),min(), andmax()make sizes fluid, and what's the zoom catch?
08Modern CSS7 questions
Features that changed how CSS is written: custom properties and@property,:has(), nesting,@scope, logical properties, and shipping new CSS safely with feature queries.- How do custom properties work — cascade, inheritance, fallbacks, and invalid values?
- What does
@propertyadd over a plain custom property? - What does
:has()make possible, and what are its limits? - How does native CSS nesting work, and how does it differ from Sass?
- What does
@scopedo, and how is scoping proximity different from specificity? - What are logical properties, and why use
margin-inlineovermargin-left? - How do you ship new CSS safely — forgiving parsing and
@supports?
09Typography, colour, and motion7 questions
The finishing layer: how fonts are matched, how text wraps and truncates, modern colour spaces and dark mode, and CSS transitions and animations.- How does the browser pick a font face, and when does it synthesise bold or italic?
- How do you truncate text with an ellipsis on one line or several?
- What do
oklch()and wide-gamut colour spaces give you overrgb()andhsl()? - How do
color-mix()and relative colour syntax work? - How do
color-schemeandlight-dark()support dark mode? - How do CSS transitions work, and how do you transition
displayor an element's entry? - How do
@keyframesanimations differ from transitions?