Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

It’s an open question to me whether one needs span tags.

Span tags can be made to behave like div tags by changing the CSS display property from their default “in-line” to “block”.

So the question is can we simply get by with <div> tags?

Neither span or div tags pretend to have any semantic meaning. This is an open question for meBoth of these elements are extensively used in modern HTML together with CSS. The only real difference is that:

  • span elements have the built in display : inline

  • div elements have the built in display : block

If you change the display property of a span to be block you can make it behave like a div. Likewise if you change the display property of a div to be inline-block then you can make it behave like a span.

We do exactly that experiment here.

So in the interests of simplicity and avoiding features it makes sense to just use <div> tags and combine it with CSS. There is less abstraction which means one needs to think through the problems more thoroughly.