Module 05 of 11

Positioning & Stacking

Lessons

About This Module

Normally the browser places elements one after another in the order they appear in your HTML. The position property lets you break out of that normal flow when you need to — pinning a header to the top of the screen, placing a badge on the corner of a card, or keeping a sidebar in view as the page scrolls. It is powerful, but it is also the source of many "why is this element in the wrong place?" moments.

This module starts with an overview of the five position values — static, relative, absolute, fixed, and sticky — and how each one decides where an element ends up. It then looks closely at sticky positioning, and finishes with z-index and stacking contexts, which control which overlapping element appears on top and explain why a huge z-index value sometimes still doesn't work.

Watch the lessons in order, then continue on to Flexbox.

Lessons

4 videos
01

CSS Position Explained

Covers all of the CSS positions — static, relative, absolute, fixed, and sticky — and why positioning can be difficult to understand at first.

02

How to Use CSS Position Sticky: A Beginner's Guide

Shows how position: sticky fixes an element in place while the user scrolls, a common technique for headers and sidebars.

03

CSS z-index Explained: Master Layering & Stacking Order

How z-index controls which elements appear on top, how it works with positioned elements, and the basics of stacking.

04

CSS Z-Index and Stacking Context

Why z-index is not a single global value: it is tied to a local stacking context, and understanding where contexts are created explains most z-index bugs.