When are Inline-block and float used? ? ?
Sometimes “Inline-block” and “float” can achieve the effect of horizontal arrangement. When should they be used respectively? ? ?
What situations are they suitable for? ? ?
Questions like this
Actually you should say it first What is the implementation effect of these two? How can it affect your application due to partially overlapping functions?
"float" is mainly used for column layout;
Inline elements (inline elements) are Attributes such as width, padding-left, padding-right, etc. cannot be set.
If you need to set these attributes and do not want them to occupy a row of space, you need to set this inline "display: inline-block";
"inline-block" is not used very much. In most cases, "block" can replace "inline-block".
"Inline elements (inline elements) cannot set properties such as width, padding-left, padding-right, etc." This sentence is wrong.
Except for , inline elements cannot be set. width, height, padding-top, padding-bottom, margin-top, margin-bottom.
The explanations above are very good! Generally speaking, it is necessary to make the elements have the characteristics of inline elements at the same time, and at the same time, specifically control the width and height. There is a compatibility problem. Float is used for typesetting out of the document flow!