Skip to content
tezvyn:

CSS

275 bites tagged CSS — interview questions with model answers, and 60-second explainers.

CSS & Design Systems1 min read

Pseudo-class versus pseudo-element in CSS

Pseudo-classes target an element in a state, pseudo-elements style a generated or sub-part using double colons, and ::before injects decorative content. precise CSS selector vocabulary.

CSS & Design Systems1 min read

Categories of Design Tokens

Design tokens fall into tiers: primitive tokens hold raw values, semantic tokens assign meaning by aliasing primitives, and component tokens scope decisions to specific UI parts.

CSS & Design Systems1 min read

Design Token Naming Conventions

Design token names encode meaning through a consistent, layered structure so values stay portable across themes and platforms. A clear convention like category-type-item-state turns scattered constants into a self-documenting, predictable system that…

Vue, Angular & Svelte2 min read

How do you bypass Svelte's scoped styles to target global elements?

Tests Svelte style encapsulation escape hatches. Strong answer: :global() syntax for elements and classes, plus risks like leaky side effects and specificity wars. Red flag: external stylesheets or inline styles as the primary solution.

Vue, Angular & Svelte2 min read

How does Vue's v-bind() CSS function work in style blocks?

Tests Vue SFC CSS transforms and browser primitives. Strong answer: Vue compiles v-bind() to scoped CSS custom properties, letting reactive values work with pseudo-selectors and media queries.

Vue, Angular & Svelte2 min read

How do _ngcontent and _nghost attributes enforce Angular style isolation?

Unique component ID, _nghost on host, _ngcontent on template nodes, and CSS rewritten with attribute selectors to scope styles. Angular's emulated encapsulation mechanics.

Vue, Angular & Svelte2 min read

How does Svelte scope component styles during compilation?

The compiler adds a unique attribute to component elements and rewrites selectors to target it, isolating styles. Knowledge of Svelte's compile-time CSS encapsulation. Claiming scoping uses runtime JS or shadow DOM.

Vue, Angular & Svelte2 min read

What attribute scopes styles to a Vue component?

This tests knowledge of Vue's style encapsulation. Add the scoped attribute to the style tag; Vue adds a unique data attribute to elements and selectors. A red flag is suggesting manual BEM or claiming scoped styles never affect child components.

Vue, Angular & Svelte2 min read

In Vue 3, what problem does Teleport solve?

This tests DOM hierarchy and CSS stacking context. A strong answer covers how Teleport moves markup to a target like body to escape ancestor transforms and z-index ceilings trapping fixed modals. Red flag: claiming it is only for cleaner HTML.

UI Design & Figma2 min read

How do you translate Figma Smart Animate into CSS or JS?

Convert easing to cubic-bezier or library curves, match ms values, animate transform and opacity, escalate layout shifts to JS. Bridging design tools to code with fidelity.

UI Design & Figma2 min read

Discuss custom web font performance and loading strategies

Critical rendering path tradeoffs between speed and design fidelity. Strong answers match font-display to UX goals, combine preloading with subsetting, and quantify byte savings. Red flag: calling swap a free win while ignoring layout shift from reflow.

UI Design & Figma2 min read

How do you identify responsive breakpoints in Figma for CSS?

Tests if you derive CSS logic from Figma structure, not pixels. A strong answer checks auto layout direction changes, wrap toggles, and resizing rules to find behavior shifts, then maps those widths to queries.

UI Design & Figma2 min read

Translate Figma Auto Layout padding, direction, and spacing to Flexbox

Tests your ability to bridge design tools and CSS layout mechanics. Match direction to flex-direction, padding to gap or container padding, space-between to justify-content, and hug/fill to flex-grow or flex-shrink.

UI Design & Figma2 min read

How would you inspect a Figma text element for CSS properties?

Your Figma-to-CSS typography workflow. A good answer selects the layer, opens the Properties tab or Dev Mode, reads font family, weight, size, line height, and letter spacing, and uses Copy as code. Eyeballing instead of inspecting.

UI Design & Figma2 min read

How would you structure a multi-theme color system in Figma and CSS?

Primitives and Semantic collections with theme modes; pipeline to CSS variables; components use semantic tokens only. Token architecture bridging Figma modes to code.

UI Design & Figma2 min read

How would you optimize and implement a full-bleed responsive hero image?

Use srcset with AVIF/WebP, CSS object-fit cover, and width/height to prevent CLS. responsive image delivery and performance budgeting across breakpoints. serving one 4K JPEG as a background image with no size hints.

UI Design & Figma2 min read

Line-height vs letter-spacing: impact on readability and values for body vs headings

This tests whether you distinguish vertical rhythm from horizontal glyph spacing. A strong answer sets body line-height to at least 1.5x per WCAG with minimal tracking, while headings use tighter line-height and tighter tracking. Red flag: identical values.

React & Next.js2 min read

Purpose of tailwind.config.js content array and JIT scanning

Tests knowledge of Tailwind's scan-to-generate pipeline. Strong answer: content defines files to scan as plain text for class tokens; JIT emits CSS only for discovered classes, keeping production CSS tiny. Red flag: calling it AST parsing or PurgeCSS config.

React & Next.js2 min read

What limits React inline styles and when are they still appropriate?

This tests React styling trade-offs. Outline: no pseudo-classes, media queries, or keyframes; maintenance and perf costs; good for dynamic state styling, prototyping, FOUC prevention, and small components. Red flag: claiming they are always bad or free.

React & Next.js2 min read

CSS Custom Properties vs JS Theme Object in React

Tests render overhead vs CSS cascade. Strong answers: CSS variables update styles without re-renders, while JS theme objects in Context force subtree re-renders. Mention scoping, SSR FOUC, and setProperty interop.

React & Next.js2 min read

Where and how to import global stylesheets in Next.js

This tests Next.js style entry points. In the App Router, import global CSS in the root layout.js; in the Pages Router, import it in _app.js. Never import global styles inside pages or components, since Next.js restricts global CSS to root-level files.

React & Next.js2 min read

BEM: Self-Documenting CSS Class Names

BEM turns classes into a mini filesystem: Block__Element--Modifier. It prevents CSS collisions in large React codebases where many teams share a global stylesheet. The footgun is turning every nested tag into an element and creating comically long names.

Design Systems2 min read

Two strategies to prevent style leakage in reusable components and their trade-offs

This tests style encapsulation in design systems. A strong answer contrasts Shadow DOM, which fully isolates CSS via a shadow root, with scoped naming like BEM or CSS Modules. Red flag: proposing global resets or !important as a solution.

Design Systems2 min read

What is a design token versus a CSS or Sass variable?

Whether you understand abstraction layers in design systems and cross-platform interoperability. Define tokens as vendor-neutral design decisions that generate platform-specific code; contrast with CSS variables (runtime, web-only) and Sass (compile-time…

Get CSS bites daily.

Five a day, five minutes, offline. With quizzes so it sticks.

Open testing — you’ll join as an early tester.