Visitar URL original
HTML-CSS-Mastery/24-display-and-normal-flow at main · a4hmad1/HTML-CSS-Mastery · GitHub
Skip to content

Latest commit

 

History

History

24-display-and-normal-flow

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

24. Display and normal flow

Understand how elements occupy space.

Learn

  • block
  • inline
  • inline-block
  • none
  • flow
  • margin collapse
  • visibility

Build

Compare display modes on three elements and document the layout difference.

Check your work

  • Open the result in a browser and inspect the HTML and computed CSS.
  • Test at narrow and wide widths and use the keyboard for interactive elements.
  • Write down one thing you changed after testing.

Deep lesson

How it works

Normal flow is the browser's default layout: block boxes stack and inline content flows within lines. Display changes box behavior. Inline-block accepts box dimensions while staying in inline flow. Display:none removes an element from layout and the accessibility tree; visibility:hidden keeps its space but hides it. Adjacent vertical margins can collapse in normal flow.

Common mistake

Use display:none only when content really should be unavailable. Spacing surprises often come from normal flow or margin collapse, not from a browser bug.

Guided challenge

Create two blocks and two inline elements. Toggle their display values one at a time, inspect dimensions, and explain how following content moves.

Completion check

  • Rebuild the core idea without copying the example line by line.
  • Explain the key HTML or CSS choice in your own words.
  • Test the result at a narrow width and with keyboard navigation where relevant.

Run the example

Open example.html in a browser. Edit style.css, save, and refresh.

Try: Change one inline-block to inline and compare its width behavior.