According to the HTML spec, <span>
is an inline element and <div>
is a block element. Now that can be changed using the display
CSS property but there is one issue: in terms of HTML validation, you can’t put block elements inside inline elements so:
<p>...<div>foo</div>...</p>
is not strictly valid even if you change the <div>
to inline
or inline-block
.
So, if your element is inline
or inline-block
use a <span>
. If it’s a block
level element, use a <div>
.