Master element layout positioning: understand static, relative, absolute, fixed, and sticky types, alongside z-index stacking layers.
1.box {2 position: static; /* Default behavior */3}Select a positioning mode and adjust offset values to observe how the target element behaves relative to its container and viewport.
.target-element {
position: relative;
top: 20px;
left: 30px;
z-index: 10;
}1.relative-box {2 position: relative;3 top: 30px; /* Push down from original spot */4 left: 50px; /* Push right from original spot */5}1.parent {2 position: relative; /* Defines the coordinate system */3}4 5.child {6 position: absolute;7 top: 20px;8 right: 20px;9}1.fixed-box {2 position: fixed;3 bottom: 20px;4 right: 20px;5}1.sticky-header {2 position: sticky;3 top: 0; /* Stick when it hits the top edge */4}1.yellow { z-index: 1; }2.orange { z-index: 2; }3.red { z-index: 3; } /* Wins! */