JS
JS Interview
Interview
CSS
Interview
Playground
⌘K
Home
JS Concepts
DSA Patterns
Interview Prep
Playground
CSS Interview Prep
105 questions across fundamentals, layout, modern CSS, and architecture
All
Easy
Medium
Hard
All Topics
Core Fundamentals
Layout Systems
Modern CSS
Architecture & Perf
Showing
105
of 105 questions
01
What is the CSS box model?
easy
Core Fundamentals
box-model
02
What is the difference between `box-sizing: content-box` and `box-sizing: border-box`?
easy
Core Fundamentals
box-model
03
What is margin collapsing and when does it occur?
easy
Core Fundamentals
box-model
04
How do negative margins work, and how do they differ from positive margins?
medium
Core Fundamentals
box-model
05
Explain how percentage-based padding is calculated. Why does `padding-top: 50%` not reference the height?
medium
Core Fundamentals
box-model
06
What happens when you set `width: 100%` on an element with padding and no `border-box`? How can this cause overflow?
hard
Core Fundamentals
box-model
07
What is CSS specificity and why does it matter?
easy
Core Fundamentals
specificity
08
How do you calculate the specificity of a complex selector?
easy
Core Fundamentals
specificity
09
Why is using `!important` considered bad practice, and when might it be justified?
medium
Core Fundamentals
specificity
10
Explain the difference in specificity between `:is()`, `:not()`, `:has()`, and `:where()`. How does each affect the cascade?
medium
Core Fundamentals
specificity
11
How does specificity interact with the CSS cascade layers (`@layer`) introduced in CSS Cascade Layers?
medium
Core Fundamentals
specificity
12
Walk through the full cascade algorithm. In what order does the browser evaluate origin, importance, layer, specificity, and source order?
hard
Core Fundamentals
specificity
13
How can a selector with no IDs ever override a selector with an ID, without using `!important`?
hard
Core Fundamentals
specificity
14
What is the difference between `display: block`, `display: inline`, and `display: inline-block`?
easy
Core Fundamentals
display-flow
15
What is the normal document flow in CSS, and which elements participate in it?
easy
Core Fundamentals
display-flow
16
What is a Block Formatting Context (BFC) and what are the practical effects of establishing one?
medium
Core Fundamentals
display-flow
17
Explain how `display: contents` works. What are its use cases and accessibility pitfalls?
medium
Core Fundamentals
display-flow
18
What is the stacking context and how does `display` interact with `z-index` to create one?
hard
Core Fundamentals
display-flow
19
What is the difference between `position: relative` and `position: absolute`?
easy
Core Fundamentals
positioning
20
What does `position: sticky` do, and what are the requirements for it to work?
easy
Core Fundamentals
positioning
21
How does `position: fixed` differ from `position: absolute`, and when can `fixed` not be relative to the viewport?
medium
Core Fundamentals
positioning
22
Explain the `inset` shorthand and how `position: absolute; inset: 0` creates a full-coverage overlay.
medium
Core Fundamentals
positioning
23
What is a containing block, and how does the positioned ancestor chain affect where an absolutely positioned element lands?
hard
Core Fundamentals
positioning
24
What is the difference between `px`, `em`, `rem`, and `%` units in CSS?
easy
Core Fundamentals
units
25
What are viewport units (`vh`, `vw`, `dvh`, `svh`, `lvh`) and when would you choose one over another?
medium
Core Fundamentals
units
26
Explain how `clamp()`, `min()`, and `max()` work. What are their advantages over media query breakpoints for fluid typography?
medium
Core Fundamentals
units
27
What happens when you use `em` units for `padding` inside an element that also uses `em` for `font-size`? Explain the resolution chain.
hard
Core Fundamentals
units
28
Which CSS properties are inherited by default, and how do `inherit`, `initial`, `unset`, and `revert` differ?
medium
Core Fundamentals
inheritance
29
Explain how `all: unset` works. What are the dangers of using it, and how does it interact with inherited vs. non-inherited properties?
hard
Core Fundamentals
inheritance
30
How does CSS custom property (`--var`) inheritance work differently from normal property inheritance? Can you break inheritance of a custom property?
hard
Core Fundamentals
inheritance
31
What does `flex: 1` actually expand to?
easy
Layout Systems
flexbox
32
What is the difference between `justify-content` and `align-items` in flexbox?
easy
Layout Systems
flexbox
33
What does `flex-wrap: wrap` do and when would you use it?
easy
Layout Systems
flexbox
34
How does `flex-shrink` interact with `min-width` and intrinsic content size?
medium
Layout Systems
flexbox
35
Explain the difference between `align-items` and `align-self` in flexbox.
medium
Layout Systems
flexbox
36
What happens when you use `gap` with flexbox and how does it differ from using margins?
medium
Layout Systems
flexbox
37
How does `flex-basis` interact with `width` and what takes priority?
medium
Layout Systems
flexbox
38
Walk through the flexbox sizing algorithm: how does the browser determine final item sizes?
hard
Layout Systems
flexbox
39
How do you handle flexbox layouts where items have unpredictable content lengths without breaking the layout?
hard
Layout Systems
flexbox
40
What is the `fr` unit in CSS Grid and how does it work?
easy
Layout Systems
grid
41
How do you place an item in a specific grid cell?
easy
Layout Systems
grid
42
What does `grid-template-areas` do and when is it useful?
easy
Layout Systems
grid
43
Explain the difference between `auto-fill` and `auto-fit` in `repeat()`.
medium
Layout Systems
grid
44
How do implicit grid tracks work and how do you control their sizing?
medium
Layout Systems
grid
45
What is `minmax()` in CSS Grid and what are common patterns for using it?
medium
Layout Systems
grid
46
How does `grid-column: 1 / -1` work and why is it useful?
medium
Layout Systems
grid
47
How does the CSS Grid auto-placement algorithm work and what does `dense` packing do?
hard
Layout Systems
grid
48
How do subgrid works and what problem does it solve?
hard
Layout Systems
grid
49
What is a media query and what are the most commonly used breakpoints?
easy
Layout Systems
responsive
50
What is the `viewport` meta tag and why is it essential for responsive design?
easy
Layout Systems
responsive
51
How do CSS `clamp()`, `min()`, and `max()` enable responsive design without media queries?
medium
Layout Systems
responsive
52
What is the difference between responsive images using `srcset` with width descriptors versus CSS-only approaches?
medium
Layout Systems
responsive
53
How do you build a truly fluid layout system that handles every screen size without breakpoints?
hard
Layout Systems
responsive
54
How do you handle responsive typography at scale, including line length control and vertical rhythm?
hard
Layout Systems
responsive
55
What are container queries and how do they differ from media queries?
medium
Layout Systems
container-queries
56
How does container query size containment work under the hood and what are its limitations?
hard
Layout Systems
container-queries
57
What are CSS logical properties and why should you use them?
medium
Layout Systems
logical-properties
58
How do logical properties interact with the full CSS layout system including transforms, positioning, and scroll behavior?
hard
Layout Systems
logical-properties
59
What does the `:nth-child()` pseudo-class do, and how does the `An+B` syntax work?
easy
Modern CSS
selectors
60
What is the difference between the `>` (child combinator) and the ` ` (descendant combinator) in CSS selectors?
easy
Modern CSS
selectors
61
Explain the `:is()` and `:where()` pseudo-class functions. How do they differ?
medium
Modern CSS
selectors
62
How does the `:has()` pseudo-class work, and why is it called the "parent selector"?
medium
Modern CSS
selectors
63
What is the `:not()` pseudo-class and how does its specificity behave in CSS Selectors Level 4?
medium
Modern CSS
selectors
64
How do attribute selectors work, and what are the substring-matching variants?
hard
Modern CSS
selectors
65
How does `:has()` enable complex conditional styling, and what are its performance implications?
hard
Modern CSS
selectors
66
What are CSS custom properties (variables) and how do you declare and use them?
easy
Modern CSS
css-variables
67
How does the fallback mechanism work in the `var()` function?
easy
Modern CSS
css-variables
68
How does custom property scoping and inheritance work, and how can you prevent inheritance?
medium
Modern CSS
css-variables
69
How do CSS custom properties interact with the CSSOM and JavaScript at runtime?
medium
Modern CSS
css-variables
70
How can you animate CSS custom properties, and why does `@property` registration matter?
hard
Modern CSS
css-variables
71
How does the `@property` at-rule enable type-safe theming systems, and what are the edge cases?
hard
Modern CSS
css-variables
72
What is the difference between CSS `transition` and `animation`, and when should you use each?
easy
Modern CSS
animations
73
What are the different `animation-fill-mode` values and why do they matter?
easy
Modern CSS
animations
74
What triggers layout, paint, and composite in the browser rendering pipeline, and how does this affect animation performance?
medium
Modern CSS
animations
75
How do CSS `@keyframes` work with multiple stops, and how does `animation-timing-function` apply to each segment?
medium
Modern CSS
animations
76
How do you use the Web Animations API alongside CSS animations, and what advantages does it offer?
medium
Modern CSS
animations
77
How do scroll-driven animations work with `animation-timeline`, and how do they differ from scroll-triggered animations?
hard
Modern CSS
animations
78
How do the `@starting-style` rule and `transition-behavior: allow-discrete` enable transitions on display changes?
hard
Modern CSS
animations
79
What are `::before` and `::after` pseudo-elements, and what is the `content` property's role?
easy
Modern CSS
pseudo-elements
80
How do `::marker`, `::placeholder`, and `::selection` pseudo-elements work, and what are their styling limitations?
medium
Modern CSS
pseudo-elements
81
How do the `::part()` and `::slotted()` pseudo-elements enable styling within Shadow DOM boundaries?
hard
Modern CSS
pseudo-elements
82
What is CSS Container Queries and how does `@container` differ from `@media` queries?
medium
Modern CSS
new-features
83
How does CSS Nesting work natively, and what are the differences from preprocessor nesting?
hard
Modern CSS
new-features
84
What is the BEM naming convention and why is it used?
easy
Architecture & Perf
methodologies
85
What is ITCSS and how does it organize stylesheets?
easy
Architecture & Perf
methodologies
86
Compare CSS Modules, BEM, and CSS-in-JS as styling approaches for component-based architectures.
medium
Architecture & Perf
methodologies
87
How do utility-first frameworks like Tailwind differ architecturally from component-based CSS methodologies?
medium
Architecture & Perf
methodologies
88
Design a CSS architecture strategy for a large multi-team design system that must scale across dozens of applications.
hard
Architecture & Perf
methodologies
89
What is critical CSS and why does it matter for performance?
easy
Architecture & Perf
performance
90
Explain the browser rendering pipeline and how CSS properties affect each stage.
medium
Architecture & Perf
performance
91
How do CSS selectors impact rendering performance and what is the browser matching algorithm?
medium
Architecture & Perf
performance
92
How does the CSS `contain` property improve rendering performance and what are its containment modes?
hard
Architecture & Perf
performance
93
How do `will-change` and layer promotion work, and what are the risks of overusing them?
hard
Architecture & Perf
performance
94
Explain how `content-visibility`, `contain-intrinsic-size`, and lazy rendering work together to optimize long pages.
hard
Architecture & Perf
performance
95
What is CSS specificity and how is it calculated?
easy
Architecture & Perf
specificity-management
96
How do CSS cascade layers (`@layer`) help manage specificity at scale?
medium
Architecture & Perf
specificity-management
97
Explain the `:where()` and `:is()` pseudo-classes and their role in specificity management.
medium
Architecture & Perf
specificity-management
98
Design a specificity strategy for a design system that supports theming, component variants, and consumer overrides without `!important`.
hard
Architecture & Perf
specificity-management
99
How does the `@scope` rule work and how does it change CSS architecture for nested components?
hard
Architecture & Perf
specificity-management
100
What is PostCSS and how does it fit into a CSS build pipeline?
easy
Architecture & Perf
tooling
101
Compare CSS preprocessors (Sass, Less) with modern native CSS features — which preprocessor features are now redundant?
medium
Architecture & Perf
tooling
102
How do you configure Stylelint or a CSS linter to enforce architectural rules like token usage and selector conventions?
medium
Architecture & Perf
tooling
103
How would you set up CSS bundle analysis, tree-shaking, and dead code elimination for a production application?
hard
Architecture & Perf
tooling
104
How do `prefers-reduced-motion` and `prefers-color-scheme` affect CSS architecture, and how should a design system handle these preferences?
hard
Architecture & Perf
accessibility
105
How do you architect CSS to meet WCAG contrast, focus visibility, and spacing requirements without sacrificing design flexibility?
hard
Architecture & Perf
accessibility