0
0
CSSmarkup~20 mins

Hidden, scroll, auto in CSS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Overflow Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2: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?
AThe container expands to fit all content, ignoring its set size.
BScrollbars appear allowing the user to scroll to see the extra content.
CThe extra content is visible outside the container boundaries.
DThe extra content is clipped and not visible or scrollable.
Attempts:
2 left
💡 Hint
Think about what 'hidden' means in everyday life, like hiding something behind a curtain.
📝 Syntax
intermediate
2: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?
Aoverflow: visible;
Boverflow: scroll;
Coverflow: auto;
Doverflow: hidden;
Attempts:
2 left
💡 Hint
Think about a door that opens only when someone wants to enter.
rendering
advanced
2: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; }
AA box that clips the text and shows no scrollbars.
BA 10rem by 3rem box with scrollbars allowing the user to scroll to see all the text.
CA box that expands to fit all the text without scrollbars.
DA box with no border and no scrollbars.
Attempts:
2 left
💡 Hint
Scroll means you can move the content inside the box to see hidden parts.
selector
advanced
2: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?
A[style*="overflow: auto"]
B.auto-overflow
C[overflow="auto"]
D:overflow(auto)
Attempts:
2 left
💡 Hint
Attribute selectors look inside the HTML tag's attributes.
accessibility
expert
3: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?
AAdd <code>tabindex="0"</code> to the container so it can receive keyboard focus.
BRemove all focusable elements inside the container.
CSet <code>overflow: hidden;</code> to prevent scrolling.
DAdd <code>aria-hidden="true"</code> to hide it from screen readers.
Attempts:
2 left
💡 Hint
Keyboard users need to focus on the container to scroll it with arrow keys.