HTML & CSS Senior cheat sheet: interview answers
Every question of this level with its correct answer and explanation, on one page for a quick review before the interview.
1. How do
@layercascade layers affect style priority?Correct answer: Layer order beats specificity: the later layer wins
The cascade compares layers first and only then specificity within a layer. So
.btnin thecomponentslayer beats#app .btnin an earlierbaselayer. Unlayered styles are stronger than any layer. For!importantthe order is reversed: important declarations in an earlier layer win. Tailwind v4 builds its styles on thetheme,base,componentsandutilitieslayers.2. How do normal (non-
!important) layered and unlayered styles rank against each other?Correct answer: Unlayered styles are stronger than any layer
Unlayered styles implicitly go into a "last" layer and beat all named layers. That lets you wrap third-party CSS in
@layer vendorand easily override it with your own styles. With!importantthe logic flips: important layered styles beat important unlayered ones.3. What does
@scope (.card) to (.card__content) { img { ... } }do?Correct answer: Styles
imginside.card, but not inside.card__content@scopedefines a scope root and an optional "lower boundary" (donut scope): styles apply inside.cardbut don't reach into.card__contentand its descendants. In addition, with equal specificity the rule with the closer root wins (scoping proximity).@scopedoesn't create a Shadow DOM.4. What problem does
subgridsolve?Correct answer: It gives a nested grid its parent's tracks, aligning parts across cards
With
grid-template-rows: subgrida child grid inherits the parent's lines. The classic example is a row of cards whose titles, text and buttons should line up even when one card's title wraps to two lines. Without subgrid, each card aligns independently.5. Which stages does the browser go through to update a frame after a style change?
Correct answer: Style → Layout → Paint → Composite
The rendering pipeline: style recalculation (Style) → geometry (Layout/Reflow) → painting layer pixels (Paint) → layer composition (Composite). Changing
widthruns everything from Layout, changingcolorfrom Paint, whiletransformandopacitycan get away with Composite alone.6. What is layout thrashing (forced synchronous layout)?
for (const el of items) { el.style.width = box.offsetWidth + "px"; }Correct answer: Repeated layout from interleaved reads and writes
Reading
offsetWidthafter writing a style forces the browser to recalculate layout synchronously to return an up-to-date value. In a loop this happens on every iteration. The fix is to read all values first, then write (batch reads/writes), or move the read out of the loop. Libraries like fastdom help too.7. What does
contain: layout paint(orcontain: content) give you?Correct answer: A promise that contents don't affect outside layout and paint, narrowing recalculation
CSS Containment isolates a subtree: changes inside don't force layout and paint of the rest of the page. Useful for widgets, feeds and complex components. Side effect:
paintclips content to the bounds and creates a containing block and a stacking context, so don't apply it thoughtlessly.8. How does
content-visibility: autospeed up long pages?Correct answer: It skips layout and paint of off-screen elements until they're needed
The browser doesn't render sections outside the viewport, saving time on the first paint. To keep the scrollbar from jumping, set an expected size via
contain-intrinsic-size: auto 500px. The DOM stays intact: find-in-page and accessibility keep working, unlike virtualization.9. Why don't
::beforeand::afterwork on<img>and<input>?Correct answer: They are replaced or void elements - there's no content to insert into
::before/::afterare inserted inside the element, before and after its content. The content of<img>,<video>,<iframe>is replaced by an external resource, while<input>and<br>are void elements. The workaround is to wrap the element in a container and attach the pseudo-element to it.displayis irrelevant: pseudo-elements work on aninline<span>.10. What is
floatstill appropriate for in modern layouts?Correct answer: For wrapping text around an image or a pull quote inside an article
Page layouts have long been built with Flexbox and Grid, but text wrapping -
float's original purpose - has no replacement. Combined withshape-outside, text can even wrap along an image's shape. The property is neither deprecated nor removed.11. Why is
emoften recommended overpxfor media query breakpoints?Correct answer:
emin media queries respects the user-set font sizeIn media queries,
emandremare based on the browser's initial font size (usually 16px), not on page styles. If a user enlarges the base font, the layout switches to the "narrow" version sooner - text won't be cramped. Withpxthat doesn't happen. Tailwind v4 defines breakpoints inremfor the same reason.12. What happens to a
position: fixedelement if an ancestor hastransform: translateZ(0)?Correct answer: It becomes positioned relative to that ancestor
An ancestor with
transform,filter,perspective,contain: paintorwill-change: transformbecomes the containing block forfixeddescendants. A modal inside an animated container suddenly "sticks" to the container instead of the window. That's why modals and toasts are rendered through a portal atbodylevel.13. How does
overflow: clipdiffer fromoverflow: hidden?Correct answer:
clipclips without creating a scroll container and doesn't breakstickyoverflow: hiddenmakes the element a scroll container (it can be scrolled programmatically), so sticky descendants start sticking to it.clipsimply clips painting, forbids any scrolling and doesn't create a BFC. Axes can be controlled separately (overflow-x: clip), and a clip margin can be set withoverflow-clip-margin.14. How should Sass modules be included now that
@importis deprecated?Correct answer: With namespaced
@useand@forwardfor re-exporting@use 'tokens'loads a module once and namespaces it (tokens.$primary) without polluting the global scope.@forwardre-exports a module's members to build a style library's public API. Sass@importis deprecated and will be removed in Dart Sass 3.0. There's no@requiredirective.15. How does Dart Sass differ from Node Sass?
Correct answer: Node Sass (LibSass) is deprecated; Dart Sass is the primary implementation
LibSass and Node Sass are deprecated and don't support
@useor the module system. Dart Sass is the reference implementation, published on npm assass(andsass-embedded). Migration means removingnode-sass, installingsass, and gradually moving from@importto@useand from/division tomath.div.16. What problems does runtime CSS-in-JS (styled-components, Emotion) have with SSR and React Server Components?
Correct answer: Styles are created at runtime, with no RSC context
Runtime CSS-in-JS computes styles during render and injects them into the document: on the server the styles must be collected and inlined into HTML (otherwise you get a flash), and on the client you pay the runtime cost. They rely on React Context, which Server Components lack, so such components must be client components. Alternatives: CSS Modules, Tailwind, zero-runtime solutions (vanilla-extract, Linaria, Panda).
17. Which techniques reduce the weight and performance impact of a custom web font?
Correct answer: WOFF2, subsetting,
preloadof the main weight andfont-displayWOFF2 compresses best. Subsetting removes unused glyphs (e.g. keeping only Latin and Cyrillic), and
unicode-rangelets the browser download only the subsets it needs.preloadspeeds up the main weight,font-displayremoves invisible text. A variable font replaces several weight files with one. In Next.js,next/fonthandles much of this.18. How does asset bundling strategy change when moving from HTTP/1.1 to HTTP/2+?
Correct answer: Multiplexing makes requests cheaper, so smaller chunks pay off
With HTTP/1.1 browsers keep ~6 connections per domain, so we concatenated files, used sprites and domain sharding. HTTP/2 and HTTP/3 multiplex requests over one connection, making those hacks less necessary or even harmful: one huge bundle invalidates the whole cache on any change. Dropping bundling entirely is still rare - compression and import chains still matter.
19. What is a performance budget?
Correct answer: Agreed limits on metrics (JS weight, LCP) that are checked in CI
A performance budget fixes thresholds - e.g. "homepage JS ≤ 170 KB gzipped" or "LCP ≤ 2.5 s on 4G" - checked automatically (Lighthouse CI, size-limit, bundlesize). Regressions are caught before release, and decisions about new libraries take their cost into account.
20. How does lab data (Lighthouse) differ from field data (CrUX, RUM)?
Correct answer: Lab is a controlled measurement; field data comes from real users
Lab data is reproducible and handy for debugging but doesn't reflect the real variety of devices, networks and scenarios. Field data (Chrome UX Report, your own RUM via
web-vitals) shows what users actually experience, and Google assesses Core Web Vitals from it. INP can't even be measured in the lab without real interactions.21. Which three metrics make up Core Web Vitals today?
Correct answer: LCP, INP and CLS
LCP - loading speed of the main content (good ≤ 2.5 s), INP - responsiveness to interactions (≤ 200 ms), CLS - visual stability (≤ 0.1). INP replaced FID in March 2024 because FID only measured the delay of the first interaction. FCP and TBT are useful but supporting metrics.
22. How do you build a horizontal gallery with slides that "snap" into place without JavaScript?
Correct answer:
scroll-snap-type: x mandatoryon the track,scroll-snap-alignon slidesCSS Scroll Snap: a container with
overflow-x: autoandscroll-snap-type: x mandatory, slides withscroll-snap-align. The browser settles the scroll on the nearest slide and supports touch, wheel and keyboard.scroll-paddingaccounts for fixed elements. JS is only needed for prev/next buttons and indicators.23. What does
@property --angle { syntax: '<angle>'; inherits: false; initial-value: 0deg; }enable?Correct answer: Declaring a typed variable that the browser can animate
A regular CSS variable is just a string, so it jumps during animation. A property registered with
@property(part of Houdini) has a type and therefore animates smoothly: that's how rotating conic gradients and animating individual color channels are done. You can also disable inheritance and set an initial value.24. How do you style the inside of a Web Component when Shadow DOM isolates its styles?
Correct answer: Through CSS variables (they inherit across the boundary) and
::part()Outside selectors don't reach into a shadow root, even with
!important. But inherited properties (color,font) and custom properties cross the boundary - theming is built on them. The component author can expose parts viapart="label", which are styled from outside withmy-el::part(label). Slotted content (light DOM) is styled with regular CSS.25. How do
min-content,max-contentandfit-contentdiffer as width values?Correct answer: Minimum by the longest word, width without wrapping, and capped
max-contentThese are intrinsic sizes that depend on content.
width: fit-contentis handy for fluid badges and buttons that shouldn't stretch to full width. In Grid they're used in track definitions:grid-template-columns: max-content 1fr.26. What creates a new stacking context even without
positionandz-index?Correct answer:
opacitybelow 1,transform,filter,isolation: isolateA stacking context is created by: the root element, positioned elements with
z-index, flex/grid items withz-index,opacity < 1,transform,filter,perspective,mix-blend-mode,isolation: isolate,contain: paint, andwill-changewith such properties.isolation: isolateis the "cleanest" way to create one without side effects.27. What conditions make the vertical margins of a parent and its first child collapse?
Correct answer: No
border,paddingor text separates themThe first child's
margin-top"falls through" outside the parent if nothing separates them. Collapsing is prevented bypaddingorborderon the parent,display: flow-root, or a flex/grid container - margins inside those never collapse. With negative values, the result is the largest positive plus the most negative.28. Why can a long word or a wide table "blow out" a
1frgrid column?Correct answer:
1frmeansminmax(auto, 1fr): the track can't be narrower than min-contentFor
frtracks the default minimum isauto, i.e. no smaller than the minimum content. A wide item grows the track, and the columns stop being equal. The fix isminmax(0, 1fr)in the track definition ormin-width: 0/overflow: hiddenon the item.29. Why is
oklch()more convenient thanhsl()for design systems?Correct answer: It's perceptually uniform: equal L looks equally light across hues
In HSL, yellow and blue with the same "lightness" look completely different, so palettes must be tuned by hand. OKLCH is based on a perception model, so shade scales are generated predictably, which simplifies contrast. Tailwind v4's default palette is defined in OKLCH.
30. What is
color-mix(in oklch, var(--brand) 80%, white)for?Correct answer: Mixing colors in CSS - a light brand tint without hardcoding
color-mix()blends colors in a given color space at a given ratio. It lets you derive hover states, translucent variants (color-mix(in srgb, red, transparent 50%)) and tints from a single brand variable. Tailwind v4 uses it to implement opacity modifiers likebg-brand/50.31. What does native CSS nesting (
&) give you?.card { padding: 1rem; &:hover { background: #eee; } .title { font-weight: 600; } }Correct answer: Browsers understand nesting natively;
&refers to the parent selectorCSS Nesting is supported by all modern browsers. Differences from Sass: nested selectors behave as if wrapped in
:is(), which affects specificity, and you can't concatenate strings like&__title- that's a preprocessor-only feature.32. What is CSS Anchor Positioning used for?
Correct answer: Tethering a tooltip or popover to another element without JS calculations
An anchor is declared with
anchor-name: --btn, and the positioned element references it viaposition-anchorand theanchor()function (orposition-area). Fallbacks exist for lack of space (position-try-fallbacks). This used to require libraries like Floating UI. Browser support isn't complete everywhere yet - check it before use.33. What is the View Transitions API?
Correct answer: An API for animating transitions between DOM states or pages
document.startViewTransition(() => updateDOM())captures the old state, applies the changes and animates the transition via::view-transition-old/newpseudo-elements, styled with regular CSS. MPAs get cross-document transitions via@view-transition. React 19.2 added a<ViewTransition>component.34. What is the minimum required for an accessible modal dialog?
Correct answer: Focus moved inside and trapped, Esc, focus restored, inert background
Keyboard and screen reader users must get into the modal, not "fall out" of it with Tab, close it and return where they were. A native
<dialog>withshowModal()does most of this: the background becomes inert, Esc closes it, focus moves. You also need a label viaaria-labelledby.aria-hiddenon the modal would hide it from screen readers instead.35. What does the
inertattribute do?Correct answer: Makes a subtree non-interactive and hidden from assistive technologies
inertis the native way to "switch off" part of a page: for example, the main content while a drawer is open. Previously you had to manually settabindex="-1"on every focusable element plusaria-hidden. A modal<dialog>makes the rest of the document inert automatically.36. What minimum text contrast does WCAG level AA require for normal text?
Correct answer: 4.5:1 for normal text
AA: 4.5:1 for normal text and 3:1 for large text (from 24px, or ~18.7px bold), as well as for UI components and meaningful graphics. 7:1 is the AAA requirement. Level AA is the standard target and a legal requirement in many countries (EN 301 549 in the EU, ADA in the US in practice).
37. How do WCAG conformance levels A, AA and AAA differ?
Correct answer: Strictness levels: A - minimum, AA - the usual target, AAA - maximum
Each WCAG success criterion has a level. A covers basics (alt text, keyboard operation), AA adds contrast, visible focus and consistent navigation, AAA adds strict requirements such as 7:1 contrast and sign language for video. Versions of the standard are 2.0, 2.1 and 2.2.
38. When are ARIA attributes needed, and when is it better to do without them?
Correct answer: If a native element exists, use it; ARIA is for custom widgets
ARIA only changes how an element is described to assistive technologies; it adds no behavior:
<div role="button">doesn't get focus or Enter/Space activation. Incorrect ARIA is worse than none. For tabs, comboboxes and trees, which have no native equivalents, follow the APG patterns.39. What does
text-wrap: balancedo on a heading?Correct answer: Distributes words so the lines are roughly equal in length
balancechooses line breaks so a multi-line heading's lines are close in length - no orphaned last word. The algorithm is expensive, so browsers apply it only to short blocks (a few lines). For paragraphs there'stext-wrap: pretty, which avoids a single word on the last line. Justification istext-align: justify.40. What are HTML landmarks, and why do they matter?
Correct answer: Regions (
header,nav,main…) for quick screen reader navigationSemantic elements implicitly get landmark roles (
banner,navigation,main,complementary,contentinfo). Screen reader users open a list of landmarks and jump to the one they need. If a page has severalnavelements, give them distinct names viaaria-label. A typical SPA problem is a missingmainor several visible ones.41. Which accessibility problem is typical for SPAs when the "page" changes on the client?
Correct answer: Screen readers aren't told about the navigation: focus and title don't change
On a full reload the browser announces the new page itself. SPAs don't get that, so you need to update
document.title, move focus to the heading ormain, or announce the change via a live region. The Next.js App Router does part of this (route announcer). Screen readers read JS-rendered content just fine.42. How does Tailwind v4 fundamentally differ from v3?
Correct answer: CSS-first config via
@theme, a new engine, automatic source detectionTailwind v4 is a rewrite: it's included with a single
@import "tailwindcss", tokens are defined in CSS via@themeand exposed as CSS variables, and you no longer list paths incontent- sources are detected automatically. Builds are much faster, and styles use@layer,@propertyandcolor-mix(). Modern browsers are required.43. How do you make Tailwind v4's dark mode follow a
.darkclass instead of the system setting?Correct answer: Override the variant:
@custom-variant dark (&:where(.dark, .dark *));In v4, variants are defined in CSS with
@custom-variant. That waydark:can be bound to a class or an attribute ([data-theme=dark]).darkMode: 'class'is a v3tailwind.config.jsoption and doesn't work inside@theme.:where()keeps specificity from increasing.44. You're designing the CSS architecture of a multilingual site including Arabic (RTL) and Japanese. What should you plan for?
Correct answer: Logical properties,
lang/dirattributes, flexible containers for textLogical properties (
margin-inline-start,inset-inline-end) mirror the layout automatically for RTL withdir="rtl".langis needed for correct fonts, hyphenation and quotes, and:lang()for language-specific styles. Text length varies across languages, so fixed widths break. CJK needs its own fonts and line-breaking rules (word-break,line-break).45. Which approach to fluid typography best respects the user's font scaling?
Correct answer:
clamp(1rem, 0.8rem + 1vw, 1.5rem)- smooth growth within boundsPure
vwignores the user's font size setting and barely changes on zoom - a WCAG problem (resize text up to 200%). Mixingrem + vwinsideclamp()gives smooth scaling while still responding to user settings. Pixel steps work but jump between breakpoints.46. A 10,000-row table lags when scrolling. Which solution is most effective?
Correct answer: Virtualization: render only the visible rows plus a small buffer
The main problem is thousands of DOM nodes: memory, layout and styles. Virtualization (TanStack Virtual, react-window) keeps dozens of rows in the DOM and swaps them while scrolling.
will-changeon thousands of elements eats memory. Changing the markup doesn't reduce node count. Simpler alternatives are pagination orcontent-visibility.47. A gallery with 50 YouTube videos loads very slowly. What should you do first?
Correct answer: Show preview images and insert the
<iframe>only on clickEach YouTube iframe pulls hundreds of kilobytes of JS and many requests. The facade pattern (e.g. lite-youtube-embed) shows a static thumbnail and swaps in the player only on interaction.
loading="lazy"on iframes also helps.autoplay=0doesn't reduce the embed's weight.48. How does
preloaddiffer fromprefetchin<link rel>?Correct answer:
preloadis urgent for the current page,prefetchis in advance for the next onepreloadsays "this resource is definitely needed now, start early" - e.g. a font or an LCP image discovered late.prefetchis a hint for the future, loaded during idle time. An unnecessarypreloadsteals bandwidth from critical resources. There's alsopreconnectto set up a connection to a domain early.49. How does
deferdiffer fromasyncon<script>?Correct answer:
deferruns in order after HTML parsing,asyncruns as soon as it loadsA regular script stops the parser.
deferdownloads in parallel and executes in order beforeDOMContentLoaded- good for dependent application scripts.asyncexecutes as soon as it's downloaded - for independent scripts like analytics. Modules (type="module") behave likedeferby default. Neither attribute affects inline scripts.50. A designer insists on fully custom styles for every control in a complex form. What's a sensible approach?
Correct answer: Style the native controls (
appearance: none,accent-color)Native controls give you accessibility, keyboard support, autofill and mobile pickers for free. Most of their appearance can be changed via
appearance: none,accent-color, pseudo-elements and:checked/:focus-visible. Hand-made<div>widgets require full ARIA pattern implementations - expensive and risky. Discuss the trade-offs with the designer.51. What does
font-size: 5cqimean inside a container query?Correct answer: 5% of the query container's inline size
Container query units (
cqw,cqh,cqi,cqb) resolve against the nearest container withcontainer-type. A card can then size its typography for wherever it is placed.52. Why style errors with
:user-invalidinstead of:invalid?Correct answer: It matches only after the user has interacted
:invalidapplies immediately, punishing users before they type.:user-invalidgives the "touched" behavior that previously needed JavaScript.53. What does the
popoverattribute give you?<button popovertarget="menu">Menu</button> <div id="menu" popover>...</div>Correct answer: A top-layer element with light dismiss
The top layer sits above all
z-indexstacking contexts, so overflow and stacking bugs disappear. Unlike<dialog>withshowModal(), a popover doesn't make the rest of the page inert.54. What problem does
@starting-stylesolve?.toast { opacity: 1; transition: opacity 0.3s, display 0.3s allow-discrete; } @starting-style { .toast { opacity: 0; } }Correct answer: It defines the "before" values for entry transitions
Without a starting style, newly displayed elements render directly in their final state. Combined with
transition-behavior: allow-discrete, enter and exit animations work in pure CSS.55. What do scroll-driven animations (
animation-timeline: scroll()) allow?Correct answer: Linking animation progress to scroll position
view()timelines tie progress to an element's visibility in the viewport. Running on the compositor, they avoid the jank ofscrollevent listeners.56. What does
color: light-dark(#111, #eee)do?Correct answer: Picks a value by the active color scheme
It requires
color-scheme: light dark(or a specific scheme) on the element or root. It reduces the number of duplicated variable definitions in media queries.57. What does
hyphens: autoneed to work correctly?Correct answer: A correct
langattribute on the pageIt helps narrow columns in languages with long words (German, Ukrainian).
overflow-wrap: anywhereis the fallback for strings like URLs.58. Why use
font-variant-numeric: tabular-numsin tables and timers?Correct answer: All digits get the same width
Many fonts use proportional digits by default ("1" is narrower than "0"). Tailwind exposes this as the
tabular-numsutility.59. What is the main advantage of a variable font?
Correct answer: One file holds a range of weights and widths
Instead of downloading 400, 500, 600 and 700 separately, you load one file and use any weight in between. It pays off when you use three or more styles.
60. How does
size-adjustin a fallback@font-facereduce layout shift?Correct answer: It scales the fallback to match the web font
Together with
ascent-overrideanddescent-overrideit makes the fallback occupy nearly the same space. Next.jsnext/fontgenerates such adjusted fallbacks automatically.61. What does
fetchpriority="high"on the hero image do?Correct answer: Asks to fetch it ahead of other images
Browsers discover many images at once and initially treat them all as low priority. Use it for one or two critical resources; marking everything high cancels the effect.
62. Why add
isolation: isolateto a component root?Correct answer: To create a stacking context for the component
It creates a stacking context without side effects like
positionortransform. Internalz-index: 10then only competes with siblings inside the component.63. What does
overscroll-behavior: containon a scrollable modal body prevent?Correct answer: Scroll chaining to the page behind it
It also suppresses pull-to-refresh and overscroll glow on mobile inside that container. Useful for chat panes, sidebars and modals.
64. What layout shift does
scrollbar-gutter: stableprevent?Correct answer: Content jumping when a scrollbar appears
It reserves space for the scrollbar even when content doesn't overflow. It matters on systems with non-overlay scrollbars (most Windows setups).
65. What happens to your colors in Windows High Contrast (forced colors) mode?
Correct answer: The system replaces most colors on the page
Focus rings made with
box-shadowor states shown only by background color can disappear. A transparentoutlinestays visible because the system paints it.66. What is a skip link?
<a href="#main" class="skip-link">Skip to content</a>Correct answer: A first link that jumps past the navigation
It is usually visually hidden until focused. Without it, keyboard users tab through the whole header on every page.
67. How do you correctly associate an error message with an input?
<input id="email" aria-invalid="true" aria-describedby="email-error" /> <p id="email-error">Enter a valid email</p>Correct answer: With
aria-invalidandaria-describedbyScreen readers then read the error when the field is focused. Color alone fails WCAG for users who can't distinguish it.
68. What does the WCAG "Reflow" criterion require?
Correct answer: Content works at 320 CSS px without side scrolling
A responsive layout usually satisfies it; fixed-width containers and
overflow-xon the body break it.69. What does WCAG 2.2 "Target Size (Minimum)" ask for?
Correct answer: Targets of at least 24×24 CSS px
Inline links in text are exempt. Platform guidelines recommend even larger touch targets (44–48px) for primary controls.
70. Why do build tools emit CSS files with content hashes (
app.3f9a1c.css)?Correct answer: So files can be cached "forever"
The HTML referencing the file is short-lived; the asset itself never changes under the same name. This avoids users getting stale styles after a deploy.
71. Why split design tokens into primitive and semantic layers?
--blue-600: oklch(0.55 0.2 260); /* primitive */ --color-action: var(--blue-600); /* semantic */Correct answer: Themes change the mapping, not every component
Dark mode or a new brand only remaps
--color-action. Components referencing--blue-600directly would all need edits.72. Why use
dir="auto"on user-generated content such as comments?Correct answer: The browser detects text direction from the content
Mixed-direction text without it shows punctuation and numbers in the wrong places.
<bdi>isolates short inline snippets like usernames.73. Why prefer
IntersectionObserveroverscrolllisteners for lazy loading or reveal effects?Correct answer: It reports visibility without forcing layout
Scroll handlers that call
getBoundingClientRect()run dozens of times per second and can cause layout thrashing. The observer batches checks off the critical path.74. Why avoid
@importinside plain CSS files?Correct answer: It creates a chain of render-blocking requests
Use
<link>tags or a bundler that inlines imports at build time. In Sass,@useis compiled away, so this doesn't apply to it.75. What does
li:nth-child(2 of .visible)select?Correct answer: The second
liamong those that have the classvisibleThe
of Ssyntax filters before counting, which fixes zebra striping in filtered lists. Plain:nth-child(2).visiblecounts all siblings first.