HTML and CSS interview questions
100 Frontend Engineering practice questions. Read what a strong answer covers, then practise it out loud against the clock.
Practise HTML and CSS questionsBeginner
- A button looks different across browsers
- A CSS rule isn't being applied
- A dropdown appears behind other content
- Block, inline and inline-block elements
- box-sizing: border-box
- Building a responsive navigation bar
- Centring an element horizontally and vertically
- Content overflows its container
- Creating a two-column layout that stacks on mobile
- CSS custom properties
- CSS Grid basics
- CSS positioning
- CSS selectors and combinators
- CSS specificity
- CSS units: px, em, rem, percentages and viewport units
- Flexbox basics
- Flexbox vs Grid
- HTML forms and input types
- Images look stretched or squashed
- Keeping the footer at the bottom of short pages
- Layout breaks on mobile screens
- Margin collapsing
- Mobile-first CSS
- Pseudo-classes and pseudo-elements
- Responsive design and media queries
- Responsive images and alt text
- Semantic HTML
- Styling a form for usability
- Text is hard to read on mobile
- The cascade and inheritance
- The CSS box model
- The viewport meta tag
- Ways to hide elements in CSS
- z-index and stacking contexts
Intermediate
- A component must adapt to different container sizes
- A sticky header hides content when jumping to anchors
- A third-party widget's styles leak into your page
- Adding right-to-left language support
- An animation looks janky
- BEM naming methodology
- Browser default styles, resets and normalize
- Cascade layers with @layer
- Container queries
- Content jumps around as images and fonts load
- CSS and the critical rendering path
- CSS changes cause unnoticed visual bugs
- CSS Modules, CSS-in-JS and utility-first CSS
- CSS subgrid
- CSS transitions vs animations and performant properties
- Customising checkboxes without breaking accessibility
- HTML document metadata for SEO and sharing
- Implementing dark mode in an existing app
- Implementing design tokens in CSS
- Logical properties and right-to-left support
- Making a page print well
- Making data tables work on mobile
- Modern CSS features: :has(), nesting and clamp()
- Reflow and repaint
- Sass and preprocessors vs native CSS
- Styles conflict across a large codebase
- Styling with Shadow DOM and web components
- Supporting older browsers while using modern CSS
- The CSS bundle has become too large
- The page scrolls behind an open modal
- Theming and dark mode with CSS
- User-generated content breaks the layout
- Web font loading and font-display
Experienced
- A page with thousands of elements renders slowly
- Advanced responsive image delivery
- An animation-heavy landing page performs poorly
- Applying customer-specific themes at runtime
- Atomic CSS and styling runtime costs
- Building a complex responsive dashboard layout
- Building a multi-brand theming system
- Building HTML emails
- Compositor layers and will-change
- Converting a desktop-first site to mobile-first
- Critical CSS extraction
- Cross-browser strategy and feature detection
- CSS containment and content-visibility
- CSS isolation between micro-frontends
- Driving design system adoption across many apps
- Embedding your app inside other sites with iframes
- Fixing poor layout stability on production pages
- How flex item sizes are resolved
- How the browser renders a page
- Implementing critical CSS for a server-rendered app
- JavaScript-driven layout causes stuttering
- Migrating a legacy CSS codebase to a new architecture
- Preventing visual regressions across a design system
- Rebuilding a component library on design tokens
- Removing unused CSS from a large application
- Rendering performance budgets
- Runtime CSS-in-JS is slowing down rendering
- Scalable CSS architecture for large organisations
- Speeding up a very long content feed
- Supporting Windows high contrast mode
- The popover API and CSS anchor positioning
- The View Transitions API
- Web fonts are delaying the largest content