When testing with alignment of div
, both have the same purpose
But what would be the difference?
When testing with alignment of div
, both have the same purpose
But what would be the difference?
inline-block
is the joining of behaviors inline
(eg: only occupy content space, do not break line) and block
(eg configurable dimensions) into a single HTML element
float
causes the element to float in the specified direction above the other HTML elements.
They can be similar because float adds some features that inline-block
has, but not all.
In some situations one can replace the other, but they do not necessarily do the same thing. Take a look at this article link that has an explanation with examples.
Float: left;
The element floats to the left
Display: inline-block
Basically, the left float only throws things to the left, since the inline-block arrow they must acquire line format as long as there is space and when the space ends it, in block form, breaks to the next line.Displays an element as inline-level block container. The inside of this block is formatted as block-level box, and the element itself is formatted in an inline-level box.
In the start links you have examples.