Questions
19 of 26
1What is the overflow property in CSS? Why is the overflow property used?
2What are the possible values for the overflow property? What is the default value of overflow?
3What happens when overflow is not handled in a container with fixed dimensions?
4What is the difference between overflow: hidden and overflow: scroll?
5What is the use of overflow: auto? What is the difference between overflow: auto and overflow: scroll?
6What is the purpose of overflow: visible?
7What is the difference between overflow-x and overflow-y?
8Can you set different overflow behavior for horizontal and vertical directions?
9How does overflow affect child elements that use absolute or fixed positioning?
10How can overflow be used to create scrollable content areas?
11How does overflow interact with padding and margins?
12Does overflow create a new block formatting context (BFC)?
13What is the difference between clip and hidden values for overflow?
14How do browsers handle overflow differently for replaced elements (like <img>, <video>)?
15How do browsers handle overflow differently for replaced elements (like <img>, <video>)?
16What is the difference between overflow: clip and overflow: hidden in CSS Level 4?
17How does overflow interact with position: sticky or position: fixed?
18Can overflow: hidden break position: sticky? Why?
19What’s the difference between using overflow: auto and using overflow: scroll in terms of performance?
20What’s the relationship between overflow and the clip-path property?
21How can you hide overflowing text with ellipsis using CSS?
22What’s the purpose of using text-overflow: ellipsis along with overflow properties?
23How can you make an image fit inside a fixed-size box without overflowing?
24How can you prevent the background from scrolling when a modal is open?
25How would you debug a layout issue where part of the content is being clipped unexpectedly?
26What is the difference between CSS overflow control and JavaScript scroll event control?
19 / 26

What’s the difference between using overflow: auto and using overflow: scroll in terms of performance?

Performance considerations between overflow: auto and overflow: scroll

Both overflow: auto and overflow: scroll handle overflowing content by adding scrollbars, but their performance and rendering implications differ slightly depending on how browsers manage layout, repainting, and scrollbar rendering.

Key Differences
  1. 1

    overflow: auto adds scrollbars only when content overflows, allowing browsers to skip rendering scrollbars when unnecessary—this can reduce layout and paint overhead.

  2. 2

    overflow: scroll forces scrollbars to be always visible, even when content fits—this can slightly increase rendering work, especially if multiple scrollable containers are present.

  3. 3

    auto generally offers better performance and a cleaner UI for dynamic layouts where overflow conditions change.

  4. 4

    On some systems, visible scrollbars (from scroll) can trigger GPU compositing or cause extra reflows when resizing or animating.

Example: auto vs scroll
Difficulty: 5/10
Topics: overflow behavior, scroll performance, rendering optimization

Scenario Questions

0-2 years experience
  1. 1

    If you set a div's CSS to overflow:auto versus overflow:scroll, what will the user see when the content fits versus when it overflows?

  2. 2

    How would you decide which overflow value to use for a modal that may have variable content height?

  3. 3

    What happens to the scrollbars if you apply overflow:scroll to an element that never overflows?

2-5 years experience
  1. 1

    We have a page where a sidebar sometimes contains long lists. After switching from overflow:auto to overflow:scroll, the page feels slower. What could be causing the performance regression?

  2. 2

    During a UI bug, a container with overflow:auto is causing layout thrashing when new items are appended. How would you investigate and fix it?

  3. 3

    Explain why using overflow:scroll on many nested elements might impact paint performance, and how you'd mitigate it.

5-8 years experience
  1. 1

    Design a reusable scrollable component library that needs to work efficiently on low‑end devices. Would you default to overflow:auto or overflow:scroll, and why?

  2. 2

    Our analytics show high main‑thread time on pages with many scrollable panels. How would you profile and optimize the overflow handling at scale?

  3. 3

    When implementing virtual scrolling, how does the choice between overflow:auto and overflow:scroll affect the browser's compositor and repaint behavior?

8+ years experience
  1. 1

    We are migrating a legacy web app that uses overflow:scroll everywhere to a modern design system. What architectural considerations and migration strategy would you propose to balance performance and consistency?

  2. 2

    Across multiple teams, some use overflow:auto and others overflow:scroll, leading to inconsistent scroll behavior and performance regressions. How would you establish guidelines and tooling to enforce a unified approach?

  3. 3

    If a new CSS spec introduces a 'smooth' overflow mode, how would you evaluate its impact on existing performance budgets and decide whether to adopt it globally?

Follow-up Questions

  • Can you walk me through how the browser decides to create a scroll layer for each case?
  • What impact does GPU compositing have when using overflow:scroll versus overflow:auto?
  • How would you test the performance difference across devices?