Lesson 29 of 30
The exact sequence of steps a browser runs through to turn HTML, CSS, and JS into pixels on screen — the mechanism underneath every 'why is this render-blocking' answer.
13 min read
Every option explains itself — why the right one is right, and why each wrong one is wrong. Miss one and it comes back later on a spaced-repetition schedule.
Question 1 of 2
Why is animating `transform` typically smoother than animating `left`/`top` for the same visual movement?
Hints without spoilers, and a plain explanation of why a wrong answer was wrong — answered only from this lesson. Free account, no card.
Sign up freeWhat interviewers actually ask about this, and what a strong answer has to cover.
A strong answer covers
Likely follow-ups
Turning downloaded bytes into an actual picture on screen follows a specific pipeline:
display: none element is parsed but excluded here).position: fixed header) without repainting everything else.HTML parses into a DOM tree; CSS parses into a CSSOM tree, at the same time.
<script> tag without async/defer blocks HTML parsing entirely at the point it's encountered — the browser must stop, fetch (if external), and execute the script before continuing to parse the rest of the document, since the script could use document.write to alter what comes next.width/top/font-size triggers layout and paint and composite (expensive) — changing transform/opacity can often skip layout and paint entirely, handled purely at the composite step (why CSS animations prefer transform over animating left/top)..offsetHeight) right after writing a style change can force a synchronous, forced reflow, a real, measurable performance trap."Why is animating transform smoother than animating left/top?" is a real, specific performance question, and tracing it through the actual rendering pipeline (transform skips layout and paint, left doesn't) is a much stronger answer than "transform is just faster."