← All videos

Engineering video

14:53 · 20 May 2024

CSS Interview Questions 2025 (Junior & Mid) - Part 2

Chapters 11 sections

  1. 0:00Introduction and Mindset Shift
  2. 1:10What is Critical CSS
  3. 1:45Extracting Critical CSS
  4. 2:58Responsive Layouts Without Media Queries

Key concepts in this video:

1. Critical CSS

Critical CSS is the minimum CSS required to render the initial view of a web page, which is extracted and loaded first to optimize web performance and core web vitals.

Watch section from 1:10 →

2. Extracting Critical CSS with Bundlers

Module bundler plugins can simulate viewports and use browser tooling like Puppeteer to calculate CSS coverage and extract critical styles into a separate initial load file.

Watch section from 1:45 →

3. Mobile Responsive Layouts Without Media Queries

Responsive layouts can be achieved without media queries by utilizing flexbox or grid along with relative sizing units like rem instead of fixed pixels.

Watch section from 2:58 →

4. Pseudo Elements and Pseudo Classes

Pseudo elements use double colons to target specific parts of an element (like the first letter or line), while pseudo classes change styling based on user interaction states like hover or active.

Watch section from 4:00 →

5. Selector Translation

Complex CSS selectors can be interpreted by identifying tag types, attribute matching criteria (such as starting with a specific value), and hierarchical child or descendant relationships within parent elements.

Watch section from 6:00 →

6. Dark Theme Implementation Using CSS Variables

Custom CSS variables declared in a root pseudo-class can be applied globally to color and background properties to implement themes that adapt to default browser settings or user toggles.

Watch section from 7:48 →

7. CSS Variables vs Preprocessor Variables

Native CSS variables exist at runtime, allowing dynamic updates, whereas Sass or less variables are compiled away at build time and replaced by static values.

Watch section from 9:21 →

8. CSS in JS Mechanics and Scoping

CSS in JS tools allow styling inside JavaScript files while module bundlers generate unique hashed class names to enforce scope isolation and prevent global namespace conflicts.

Watch section from 10:00 →

9. Advantages and Disadvantages of CSS in JS

CSS in JS offers quick dynamic styling and component isolation, but it introduces debugging challenges with generated hashes, extra build workloads, and complex server-side rendering setup requirements.

Watch section from 12:00 →

Transcript

Imagine you go to five interview stages and nail all the 10-cal interviews, just to fail in the last interview because you don't know how to center a simple div. Today, we will answer the top most ask CSS interview questions, you'll also find out just how much CSS should a JavaScript developer learn, a simple trick you can apply right now to solve any CSS interview question you get, and the number one mistake developers make when answering CSS interview questions.