In terms of CSS, there is no difference. You can style any element regardless of its semantics however you like.
Likewise, in terms of HTML, how you style them with CSS does not affect their nature. A <div>
always accepts any flow content, which is typically represented as block-level elements in CSS, or phrasing content, which is typically represented as inline elements in CSS. Note however that there isn't a necessary correlation between the two concepts. A <span>
on the other hand can only have phrasing content.
In valid HTML, this means while a <div>
can contain a <span>
, a <span>
cannot contain a <div>
.
Both elements are similar in that they carry no semantics by themselves; they simply function as grouping elements for their contents, typically used for styling purposes.
See the HTML5 spec for <div>
and <span>
for more details.