-1

What is the difference between inline-block and block?

And when should you use those values?

DevinRa
  • 115
  • 1
  • 7
  • https://stackoverflow.com/questions/8969381/what-is-the-difference-between-display-inline-and-display-inline-block – Dai Apr 05 '22 at 03:00

2 Answers2

0

This page illustrates the difference pretty well.

The functional difference is that:

Compared to display: block, the major difference is that display: inline-block does not add a line-break after the element, so the element can sit next to other elements.

You can think of the difference as that you want to use the behaviour of block elements inline, since normal inline elements don't allow such behaviours.

cSharp
  • 2,884
  • 1
  • 6
  • 23
-1

The major difference is that inline-block does not add a line-break after the element, so the element can sit next to other elements in a line (as an inline element)

So additionally inline-block allows setting both width and height on the element. Inline elements don't allow set width and height.

Arman Ebrahimi
  • 2,035
  • 2
  • 7
  • 20