HTML5 Beginner Basics · 1 min read

div vs span

Start the HTML5 learning path »

❮ HTML5 Home All Tutorials ❯

When do I use div or span?

Block vs inline containers.

Example

Interactive preview available
HTML5 Example
<div class="card">
  <span class="badge">New</span>
  <p>Card body</p>
</div>

Line-by-Line Walkthrough

Prefer semantic tags when they fit the meaning.

Need more coins?

You do not have enough coins for this action.

Your balance: 0 coins

Share

Reactions

Loading reactions…