0
0
CSSmarkup~20 mins

Position relative in CSS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Relative Positioning Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding position: relative effect on layout
What happens to the space originally occupied by an element when you apply position: relative and move it using top or left properties?
AThe element moves visually, but the original space it occupied remains reserved in the layout.
BThe element moves and the layout adjusts, removing the original space it occupied.
CThe element stays in place and only its content moves inside it.
DThe element disappears from the layout and only appears where moved.
Attempts:
2 left
💡 Hint
Think about whether the element's original spot is still counted by other elements.
📝 Syntax
intermediate
2:00remaining
Which CSS snippet correctly moves an element 20px down and 10px right using position relative?
Choose the CSS code that correctly moves an element 20px down and 10px right using position: relative.
Aposition: relative; bottom: 20px; right: 10px;
Bposition: relative; top: 20px; left: 10px;
Cposition: relative; top: -20px; left: -10px;
Dposition: absolute; top: 20px; left: 10px;
Attempts:
2 left
💡 Hint
Positive top moves down, positive left moves right.
rendering
advanced
2:00remaining
Visual result of relative positioning with negative values
Given this CSS, what will you see in the browser?

.box { position: relative; top: -15px; left: -30px; width: 100px; height: 100px; background-color: blue; }
ANo blue box appears because negative values are invalid.
BA blue box shifted 15px down and 30px right, overlapping other content.
CA blue box shifted 15px up and 30px left from its original position, with original space still reserved.
DA blue box stays in place but its content moves inside it.
Attempts:
2 left
💡 Hint
Negative top moves up, negative left moves left.
selector
advanced
2:00remaining
Which CSS selector targets only elements with position relative?
Which CSS selector correctly selects all elements that have position: relative applied?
A*[style*='position: relative']
B:is([style*='position: relative'])
C:where([style*='position: relative'])
DThere is no pure CSS selector to select elements by computed style.
Attempts:
2 left
💡 Hint
Think about how CSS selectors work versus styles applied in CSS or inline.
accessibility
expert
3:00remaining
Accessibility impact of using position: relative with large offsets
What is a potential accessibility concern when using position: relative with large top or left offsets to move content visually?
AScreen readers may read content in the original order, causing confusion if visual order differs.
BKeyboard navigation will automatically follow the visual position of elements.
CUsers with color blindness will not see the moved content.
DThere is no accessibility concern because relative positioning does not affect content order.
Attempts:
2 left
💡 Hint
Think about how assistive technologies read content versus how it looks visually.