Part 2: Box Model, Display, and Positioning
Introduction
The Box Model
βββββββββββββββββββββββββββββββββββ
β margin β
β βββββββββββββββββββββββββββββ β
β β border β β
β β βββββββββββββββββββββββ β β
β β β padding β β β
β β β βββββββββββββββββ β β β
β β β β content β β β β
β β β βββββββββββββββββ β β β
β β βββββββββββββββββββββββ β β
β βββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββbox-sizing
box-sizingMargin, Padding, and Border
Shorthand Syntax
Individual Properties
Logical Properties (Modern CSS)
Border
Outline
Margin Collapse
Display
display: block
display: blockdisplay: inline
display: inlinedisplay: inline-block
display: inline-blockdisplay: none
display: nonedisplay: flex
display: flexdisplay: grid
display: griddisplay: contents
display: contentsWidth and Height
width: auto vs width: 100%
width: auto vs width: 100%Viewport Units
aspect-ratio
aspect-ratioOverflow
Positioning
position: static (default)
position: static (default)position: relative
position: relativeposition: absolute
position: absoluteposition: fixed
position: fixedposition: sticky
position: stickyz-index
z-indexThe float Property
float Propertyvisibility vs display: none vs opacity: 0
visibility vs display: none vs opacity: 0Property
Space Reserved
Accessible to Screen Readers
Events
Summary
Concept
Key Point
Up Next
Last updated