HTML - Block vs Inline

Overview

Estimated time: 15–20 minutes

Concepts

  • Block: starts on a new line, stretches horizontally (e.g., div, p, section).
  • Inline: flows within text (e.g., span, a, strong).

Examples

<div>Block</div>
<p>Text with <span>inline</span> content.</p>

Common Pitfalls

  • Putting block-level elements inside purely inline-only contexts.