MCQ Hive stays free thanks to ads. Please disable your ad blocker for this site so content and features keep working.
Web Development
CSS
Beginner
Q
What does position: sticky do?
AIt is the same as fixed
BIt works only on images
CThe element acts as relatively positioned until a scroll threshold is reached, then sticks like a fixed element within its container
DIt removes the element from the flow
Correct Answer:
C. The element acts as relatively positioned until a scroll threshold is reached, then sticks like a fixed element within its container
Explanation:
It needs a threshold such as top: 0, and an ancestor with overflow: hidden can stop it from working.