
Lesson 06 · 11 min
position and layers
static is in the flow. relative anchors absolute. fixed is relative to the window. z-index doesn't work without a stacking context.
The default is static. relative shifts the element but keeps its place in the flow. absolute is positioned from the nearest ancestor whose position isn't static. fixed is relative to the viewport (until an ancestor gets a transform — surprise). sticky acts like relative until it sticks while scrolling.
Sign in to continue
The rest of this lesson opens after sign up
The first lesson of every course is open without an account. To read on, solve the practice and use Ask, create a free account or log in.