Command Palette

Search for a command to run...

Hectal
Back to the lesson: Topic 5.4 — The display Property
CSS · Example 3 of 3

flow-root contains a float

display decides what kind of box an element makes: a block that takes a full row, an inline box that flows inside text, an inline-block mix of both, no box at all (none, contents), or a block that contains its own layout (flow-root).

Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.

Ready for more? This phase has 5 hands-on exercises with automatic checks.

Practice questions

Write the code in the editor, run it, then open the model answer to compare.

01

Make three <a> tags look like 120px-wide, 40px-tall buttons in a row, without Flexbox. Log the offsetWidth of the first.

02

A .list wrapper must disappear from layout while its three .item children stay. Log the wrapper's getBoundingClientRect().height and the number of visible items.

Explain it without notes

01

What are the differences between block, inline and inline-block boxes?

02

Compare display: none, visibility: hidden and display: contents.

03

What problem does display: flow-root solve?

04

What do the outer and inner display types mean? Give examples.

flow-root contains a float

Preview

Press Run to see the page.

Console

Nothing logged yet.

Expected console output

plain contains the float: false
root contains the float: true