SystemTutor
About
Sign in
Loading course documentation…
SystemTutor

COURSES

  • Data Structures & Algorithms
  • CSS MasterclassNew course
  • System DesignNew course

PRACTICE

  • Algorithm practice
  • CSS practice

LEGAL

  • Privacy Policy
  • Terms of Service
  • About

© 2026 SystemTutor. All rights reserved.

Built with 🫶 by Shatlyk

Welcome to CSS
The Box Model and SizingWriting Modes and Logical PropertiesSizing ElementsBorders and ShadowsDisplay and Document FlowNormal FlowFloats and ColumnsPositioning and StackingStacking and Z-Index Measuring boxes and predicting their positions
Box Model and Flow

Display and Document Flow

Distinguish an element’s place among its neighbors from the layout it gives its children.

When you read a heading followed by a paragraph, the heading usually occupies a line of its own. A link inside the paragraph follows the surrounding words. The browser lays out these boxes according to their display type.

Look at the neighbors

In ordinary horizontal text, a block-level box such as a paragraph starts a new block below the previous one. With automatic width, an ordinary block generally fills the available width. An inline box such as a link fits into the current line. If its words reach the edge of the paragraph, the link can continue on the next line.

Suppose a sentence contains two short links with room for both. As inline elements they can share a line with the surrounding text. Change each link’s display to block and each begins a separate block. Both are still links that can be followed with the keyboard. Display changes the layout boxes the browser generates.

Look inside the box

An element also establishes a layout for its children. For example, display: flex ordinarily gives the container a block-level place among its neighbors and arranges its children using Flexbox. With inline-flex, the children still use Flexbox, while the container itself can sit alongside text.

display: none suppresses the boxes for the element and its descendants. The surrounding content closes the gap, and hidden controls are ordinarily unavailable to keyboard and assistive-technology users.

Key Takeaways

  • An element’s outer display determines how it participates in its parent’s layout.
  • Its inner display determines how its own children are laid out.

Try it yourself

Try it yourself

Give each label its own line

HTML + CSS

Loading code editor…

Live preview

Updating…

Final output

No comparison yetChecks after 3s without edits
Loading your draft…

How is this lesson?

Previous lessonBorders and ShadowsNext lessonNormal Flow
Edit on GitHubReport on GitHub
On this page
%

On this page

Look at the neighborsLook inside the boxKey TakeawaysTry it yourself