Normal flow, box model, and display

W3C CSS Snapshot 2026

The browser lays out HTML as boxes. Start by looking at what happens before you choose Flexbox, Grid, or positioning.

On this page

What is normal flow?

Normal flow is the default arrangement of boxes. In the usual horizontal writing mode, paragraphs are block boxes and appear one below another. Inline text flows along a line and wraps when it runs out of space.

How to try it Save this example as a new .html file, then open it in your browser. After a change, save and reload.

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>What is normal flow?</title>
  <style>
    p { background: #d6efea; }
  </style>
</head>
<body>
<p><strong>Your order</strong> is ready.</p>
<p>Your package is on the way.</p>
</body>
</html>

What to expect Two colored blocks appear on separate lines. Bold text stays within the first paragraph’s line.

What are the four parts of a box?

Content is what the element contains. Padding is the space between content and the border. The border is the edge around it. Margin adds space outside the border. With content-box, a declared width of 120px plus 10px padding and a 2px border on both sides makes a 144px border box.

How to try it Save this example as a new .html file, then open it in your browser. After a change, save and reload.

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>What are the four parts of a box?</title>
  <style>
    .notice { width: 120px; padding: 10px; border: 2px solid teal; margin: 16px; }
  </style>
</head>
<body>
<p class="notice">Your order is ready.</p>
<p>Your package is on the way.</p>
</body>
</html>

What to expect The first box has empty space inside its border and a gap around it. Inspect it and find the box model in DevTools.

How does box-sizing change width?

With border-box, the declared width includes content, padding and border. The margin still sits outside that total. The two boxes here have the same width declaration but different sizing rules.

How to try it Save this example as a new .html file, then open it in your browser. After a change, save and reload.

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>How does box-sizing change width?</title>
  <style>
    p { width: 120px; padding: 10px; border: 2px solid teal; }
    .notice { box-sizing: border-box; }
  </style>
</head>
<body>
<p class="notice">Your order is ready.</p>
<p>Your package is on the way.</p>
</body>
</html>

What to expect The first outer border is 120px wide. The second is 144px wide.

How do block, inline, and inline-block fit?

display describes how a box participates in layout. A block box starts on its own line. Normal inline text may share or wrap across lines. An inline-block box stays on one line as a unit and can have a set width and height.

How to try it Save this example as a new .html file, then open it in your browser. After a change, save and reload.

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>How do block, inline, and inline-block fit?</title>
  <style>
    span { background: #d6efea; width: 90px; }
    .block { display: block; }
    .badge { display: inline-block; }
  </style>
</head>
<body>
<span class="block">Block</span>
<p>Product: <span class="badge">Pen</span> <span>Inline</span></p>
</body>
</html>

What to expect Block takes its own line. Pen stays next to the rest of the text and is 90px wide; the normal inline label uses its text width.

Choose a layout for a group of boxes

Use normal flow for content that simply follows the previous content. The Flexbox lesson shows how to align a row or column of items. The Grid lesson shows how to design columns and rows together.

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Flexbox and Grid</title>
    <style>
      .row { display: flex; gap: 1rem; }
      .grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
      }
    </style>
  </head>
  <body>
    <h2>Flexbox row</h2>
    <div class="row"><div>Books</div><div>Notes</div></div>

    <h2>Grid with two columns</h2>
    <div class="grid">
      <div>Books</div><div>Notes</div>
      <div>Maps</div><div>Guides</div>
    </div>
  </body>
</html>

Official references