An interview question about float and inline-block

two groups of div, have the same size, width and height, one is flaot:left type, and the other is inline-block type. What is the difference between these two groups? (the width is as big as the height, not the aliasing phenomenon of float)

Mar.12,2021

1.inline-block has box gaps;
2.inline-block is not fully supported in ie67, only display:inline elements are supported;
only thinks of so many


for the time being.

there are the following differences that I can think of:

  1. float is not affected by the parent element text-align
  2. inline-block will be affected by spaces between elements, float will not
  3. float will cause the parent element to collapse highly, and inline-block will not
  4. float is more compatible than inline-block
  5. When the content in the
  6. element exceeds, float will not squeeze out other elements, but inline-block will
Menu