CSS3 & Modern Layouts (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)
What are the CSS Positioning schemes (`static`, `relative`, `absolute`, `fixed`, `sticky`)?
junior LevelcssBasic
In Simple Words:
static(Default): Normal document flow. Ignorestop,bottom,left,right, andz-index.relative: Positioned relative to its normal static position. Offsetting it withtop: 10pxshifts its visual appearance while preserving its original occupied space in the document layout. Acts as an anchor for absolute children.absolute: Removed from normal document flow. Positioned relative to the nearest ancestor that has a position other thanstatic(or the viewport if none exists).fixed: Removed from document flow. Positioned relative to the browser viewport. Stays pinned in place during page scrolling (e.g., sticky header or modal overlay).sticky: Hybrid. Behaves asrelativeuntil the element reaches a designated scroll threshold (e.g.top: 0), at which point it acts asfixedwithin the boundaries of its parent container.