Challenge - 5 Problems
Overflow Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
What happens when
overflow: hidden; is applied?If a container has content larger than its size and
overflow: hidden; is set, what will the user see?Attempts:
2 left
💡 Hint
Think about what 'hidden' means in everyday life, like hiding something behind a curtain.
✗ Incorrect
overflow: hidden; clips any content that goes beyond the container's size. The user cannot scroll to see it, so it is effectively hidden.
📝 Syntax
intermediate2:00remaining
Which CSS rule correctly enables scrollbars only when needed?
You want scrollbars to appear only if the content is bigger than the container. Which CSS
overflow value should you use?Attempts:
2 left
💡 Hint
Think about a door that opens only when someone wants to enter.
✗ Incorrect
overflow: auto; shows scrollbars only if the content is larger than the container. scroll always shows scrollbars, even if not needed.
❓ rendering
advanced2:30remaining
What will the user see with this CSS?
Given this HTML and CSS, what will the user see in the browser?
<div class="box">This is a very long text that will not fit inside the box.</div>.box { width: 10rem; height: 3rem; overflow: scroll; border: 1px solid black; }Attempts:
2 left
💡 Hint
Scroll means you can move the content inside the box to see hidden parts.
✗ Incorrect
overflow: scroll; always shows scrollbars, so the user can scroll inside the fixed-size box to see all content.
❓ selector
advanced2:30remaining
Which CSS selector targets only elements with overflow set to
auto?You want to style only elements that have
overflow: auto; set in their inline style attribute. Which selector works?Attempts:
2 left
💡 Hint
Attribute selectors look inside the HTML tag's attributes.
✗ Incorrect
[style*="overflow: auto"] selects elements whose style attribute contains the text overflow: auto. Other options are invalid or select by class or non-existent pseudo-class.
❓ accessibility
expert3:00remaining
How to ensure keyboard users can scroll a container with
overflow: auto;?You have a scrollable container with
overflow: auto;. What is the best way to make sure keyboard users can scroll it?Attempts:
2 left
💡 Hint
Keyboard users need to focus on the container to scroll it with arrow keys.
✗ Incorrect
Adding tabindex="0" makes the container focusable by keyboard. Then users can scroll it using keyboard arrows. Hiding it or removing focusable elements prevents accessibility.