It hides text visually while keeping it available to assistive tech, commonly used for icon-only controls.
CSS Interview Questions
Fixed heights can cause clipping/overflow bugs across languages, user settings, and responsive contexts.
Question 48
What is `scroll-margin-top` used for?
It offsets anchor scrolling so content is not hidden under sticky headers.
It creates snapping behavior for carousels/sectioned scrolling but should be used carefully for accessibility and control.
initialresets to spec default,unsetacts inherited-or-initial,revertreturns to prior cascade origin behavior.Repeatedly increasing selector strength to override old rules. Avoid with architecture, layering, and consistent conventions.
It gives explicit cascade ordering groups (base/components/utilities), reducing override chaos.
Use fluid sizing (
clamp) with sensible min/max and maintain adequate contrast/line-height.Question 54
What are safe area insets for mobile?
Use env variables like
env(safe-area-inset-bottom)to avoid clipping UI behind notches/system bars.Browser UI chrome can change viewport height dynamically. Prefer modern viewport units (
dvh,svh) where supported.Render-blocking CSS delays first paint. Keep critical CSS lean and defer non-critical styles where possible.
Question 57
How can you reduce CSS bundle size?
Purge unused styles, reduce one-off selectors, consolidate tokens, and avoid duplicated utility compositions.
Hide navigation/ads, optimize typography/spacing, and ensure links or key data remain readable in print/PDF.
It can adapt UI for users who request higher or lower contrast, improving accessibility.
Question 60
How do you test CSS robustness?
Test with zoom, long text, RTL language, reduced motion, dark mode, and narrow viewport edge cases.