InterviewStack.io LogoInterviewStack.io

CSS Styling and Responsive Design Questions

Covers Cascading Style Sheets fundamentals and practical implementation of responsive and adaptive layouts across devices. Topics include selectors, specificity, cascade, the box model, margins, padding, positioning, and common layout techniques such as Flexbox and CSS Grid. Candidates should understand media queries and breakpoint strategies, mobile first versus desktop first approaches, relative units and viewport units, and techniques for touch friendly interactions. Also includes handling component states such as hover, focus, active, and disabled; maintaining visual consistency with design specifications; writing maintainable styles with methodologies such as BEM or utility classes; using CSS preprocessors and component styling approaches including CSS in JavaScript; testing and debugging responsive layouts across screen sizes and browsers; and balancing visual fidelity with performance and accessibility. At junior levels emphasize producing clean, working layouts that adapt across typical breakpoints; at senior levels emphasize scalable architecture, advanced layout patterns, progressive enhancement, and performance optimizations.

HardTechnical
48 practiced
Implement theme switching between light and dark modes using CSS custom properties and prefers-color-scheme. Requirements: respect the user's system preference by default, allow the user to override and persist their choice in localStorage, and apply the chosen theme without a full page reload. Provide the minimal CSS and JavaScript snippets and explain accessibility considerations such as contrast and reduced-motion.
MediumTechnical
25 practiced
Using SCSS (Sass), write a reusable button component that supports primary and secondary variants, responsive padding, theme color variables, and a mixin for a hover shadow effect. Show variable declarations, mixin usage, and the component structure in SCSS only, and explain how to keep the output CSS maintainable.
MediumTechnical
31 practiced
A product detail page shows a high Cumulative Layout Shift (CLS) score. The suspected causes are images, ad slots, and dynamically injected content. Describe a step-by-step approach to identify which elements cause layout shift, and list CSS and minimal-JS fixes you would apply (for example, reserving space, aspect-ratio, lazy-loading strategy, and font loading settings).
EasyTechnical
27 practiced
Write plain CSS (no frameworks) for a responsive, mobile-first centered container. Requirements: container should be fluid on small screens, have width:100% up to a max-width of 1200px on large screens, be horizontally centered, include 16px side padding on small screens and 32px side padding on screens >= 768px. Provide the CSS rules only.
HardTechnical
31 practiced
Write performant CSS for a hover animation on a card so that it 'lifts' slightly and fades a shadow using only transforms and opacity where possible. Requirements: prefer compositing-friendly properties, include a will-change recommendation, and provide a fallback for older browsers. Provide CSS and a short explanation of how compositing layers reduce paint cost.

Unlock Full Question Bank

Get access to hundreds of CSS Styling and Responsive Design interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.