Challenge - 5 Problems
Position Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
Understanding
position: fixed behaviorWhat happens to an element with
position: fixed when you scroll the page?Attempts:
2 left
💡 Hint
Think about a sticky note stuck to your computer screen that never moves when you scroll.
✗ Incorrect
An element with position: fixed is fixed relative to the browser window (viewport). It stays visible in the same spot even when you scroll the page.
🧠 Conceptual
intermediate2:00remaining
How
position: sticky worksWhich statement best describes how
position: sticky behaves?Attempts:
2 left
💡 Hint
Imagine a header that scrolls up but then sticks at the top of the page.
✗ Incorrect
position: sticky acts like a normal element until the viewport scrolls past a defined offset, then it sticks in place.
📝 Syntax
advanced2:00remaining
CSS for sticky header with top offset
Which CSS snippet correctly makes a header sticky at 0 distance from the top of the viewport?
CSS
header {
/* Your CSS here */
}Attempts:
2 left
💡 Hint
Sticky means it scrolls until it reaches the top, then stays there.
✗ Incorrect
position: sticky with top: 0 makes the element stick to the top of the viewport when scrolling.
❓ rendering
advanced2:00remaining
Visual effect of fixed vs sticky
You have two boxes: one with
position: fixed; top: 10px; and another with position: sticky; top: 10px;. What will you see when you scroll down the page?Attempts:
2 left
💡 Hint
Think about which box behaves like glued to the screen and which one only sticks after scrolling.
✗ Incorrect
The fixed box stays visible at 10px from the viewport top always. The sticky box scrolls with content until it reaches 10px from top, then it sticks there.
❓ accessibility
expert3:00remaining
Accessibility considerations for fixed and sticky elements
Which accessibility best practice should you follow when using
position: fixed or position: sticky for navigation bars?Attempts:
2 left
💡 Hint
Think about users who navigate with keyboard or screen readers and how fixed bars might block content.
✗ Incorrect
Fixed or sticky navigation bars must be accessible by keyboard and not block important content. Proper focus management and ARIA roles help users navigate easily.