Inline Elements in Normal Flow
What You'll Learn
You'll learn how inline elements flow side-by-side across a line and automatically wrap when they reach the edge of their container.
How Inline Elements Flow
Unlike block elements that stack vertically, inline elements flow horizontally like words in a sentence. They sit next to each other on the same line until they run out of room, then wrap to the next line automatically.
Think of inline elements like words you're typing: they line up left-to-right, and when you reach the edge of the page, the text naturally continues on the next line. This is exactly how <span>, <a>, <strong>, <em>, and other inline elements behave.
Key Behaviors
Side-by-side placement: Inline elements don't force line breaks. Multiple inline elements will share the same horizontal space.
Container-edge wrapping: When an inline element reaches the right edge of its parent container, it wraps to the next line—just like text wrapping in a word processor.
Width determined by content: Inline elements only take up as much width as their content needs. You cannot manually set width or height on most inline elements (they ignore those properties).
Respects white space: Spaces, tabs, and line breaks in your HTML between inline elements become visible spaces in the rendered layout.
span {
background-color: lightblue;
padding: 4px;
}
With this CSS, multiple <span> elements will appear as blue boxes flowing horizontally, wrapping naturally when they hit the container's edge.
Key Takeaway: Inline elements flow horizontally like words in a paragraph, wrapping automatically at container edges and sizing themselves to their content.