Forum digitalis

2.5 Positioning

Introduction

CSS allows precise control over the placement of elements. position defines the type of positioning: static (default), relative (relative to its normal position), absolute (relative to the nearest positioned ancestor), fixed (fixed in the viewport), and sticky (sticks while scrolling within a container). top, left, right, and bottom define offsets.

div { position: absolute; /* absolute position */ top: 50px; /* distance from top */ left: 100px; /* distance from left */ }