Boxes and positioning
Display and normal flow
Compare block, inline, inline-block, none, flex, and grid boxes while preserving the document's natural reading order.
8 minute lesson
Normal flow lays block boxes one after another in the block direction and inline content into line boxes. It gives the document a usable reading order before specialized layout begins.
blockstarts a new block and usually fills available inline space.inlineparticipates in text flow and does not accept width and height normally.inline-blockflows inline but keeps box dimensions.flexandgridcreate layout containers for their children.noneremoves the element’s box from layout.
display has an outer role and an inner role. display: flex makes the element behave as a block externally while laying out its direct children with Flexbox internally. inline-flex changes the outer participation but keeps the same flex formatting context inside.
visibility: hidden hides a box but preserves its space. display: none creates no box and normally removes that subtree from the accessibility tree. Neither should be used when content must remain available to assistive technology but merely look visually hidden.
Start with normal flow. Add a layout mode only when the content needs it. A page built on natural source order stays more resilient and accessible when CSS fails or the viewport changes.
Disable display: flex or grid in DevTools. If the source order becomes confusing, repair the HTML rather than depending on visual rearrangement.
Lesson completed