×

html · level 1 · unit 5 · lesson 3

  1. meet it
  2. guess first
  3. your turn
  4. fix it
  5. nailed it

Tap a green word if you get lost.

meet it

<div> groups blocks and <span> wraps a few words.

Some elements are blocks: each starts on a new line and stretches across the page, like <h1>, <p> and <ul>. Others are : they sit inside a line of text, like <a> and <strong>.

<div> is a plain block. It groups other elements together, like a box holding a pile of things. On its own it adds no look at all.

<span> is a plain inline element. It wraps a few words inside a line without changing them. Both become useful once you give them names, in the next lesson.

<div>
  <h2>Biscuit</h2>
  <p>Age: <span>3</span></p>
</div>
<div>
  <h2>Mittens</h2>
  <p>Age: <span>5</span></p>
</div>

Press show my page to see it here.

Run it: the page looks the same as it would without the boxes, but the code is grouped.