Versions Compared

Key

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

Both 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-block

  • 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.

...