Questions
18 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?
18 / 26

Can overflow: hidden break position: sticky? Why?

How overflow: hidden affects sticky positioning

Yes, overflow: hidden can break position: sticky. This happens because a sticky element only sticks within the boundaries of its nearest scrollable ancestor. When an ancestor has overflow: hidden, it creates a new clipping and scrolling context that confines the sticky element’s behavior to that container.

Why It Happens
  1. 1

    overflow: hidden establishes a new containing block for sticky elements, so the element can only stick within that box’s visible area.

  2. 2

    Once the sticky element reaches the boundary of the ancestor with overflow: hidden, it gets clipped and stops being sticky.

  3. 3

    This behavior ensures that sticky elements don’t overlap or escape their scrollable container.

  4. 4

    To preserve sticky behavior, the parent element should have overflow: visible (or no overflow property set).

Example: Overflow hidden breaking sticky
Difficulty: 5/10
Topics: position: sticky, overflow handling, layout containment

Scenario Questions

0-2 years experience
  1. 1

    You have a sidebar that should stay visible while scrolling using position: sticky, but its parent has overflow: hidden. What will happen and how would you fix it?

  2. 2

    If you add overflow: hidden to a container that holds a sticky header, will the header still stick to the top of the viewport? Explain why.

2-5 years experience
  1. 1

    We noticed that a sticky navigation bar stopped working after we added overflow: hidden to a wrapper div to hide scrollbars. Walk me through how you would diagnose and resolve the issue.

  2. 2

    In a feature where a modal uses overflow: hidden on the body to prevent background scrolling, a sticky footer inside the modal no longer sticks. What are the underlying CSS rules causing this, and what alternatives could you consider?

5-8 years experience
  1. 1

    Our design system includes a reusable Card component that uses position: sticky for a floating action button. Some consumers wrap the Card in a container with overflow: hidden for clipping. How would you design the component or guidelines to avoid sticky breaking in such cases?

  2. 2

    When implementing infinite scrolling lists with sticky section headers, we sometimes need to clip overflow for performance. Discuss the trade‑offs of using overflow: hidden versus alternative approaches, and how you'd ensure sticky behavior remains reliable at scale.

8+ years experience
  1. 1

    Across multiple teams, we plan to migrate from CSS‑only sticky headers to a JavaScript‑driven scroll‑spy solution because some legacy browsers and overflow‑hidden containers break sticky. How would you evaluate the impact, migration path, and long‑term maintenance considerations?

  2. 2

    If a large web app uses many nested scroll containers with overflow: hidden, and sticky elements are required throughout, what architectural guidelines would you establish to prevent layout bugs and keep the CSS maintainable?

Follow-up Questions

  • What other overflow values affect sticky positioning?
  • Can you think of a scenario where you’d intentionally combine overflow: hidden with sticky?
  • How does the browser compute the containing block for a sticky element?