Left suspension: float:left;
Right suspension: float:right;
The use of float is quite wide. Here I briefly introduce the common usages in the collection:
If the child element is suspended, it will cause the parent element to collapse at a height. This part involves clearing the suspension. The next chapter will mention the explanation of clearing the suspension.
So back to the point,
The first phenomenon float=inline-blockThe suspension will be the style of 4 blocks becoming inline block mode: as shown in the figure below
<style> div{ width:200px; height:200px; background-color: pink; border:1px solid black; float:left; } </style><body> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div>The second phenomenon:
As shown in the figure below, since the first one is suspended, the second block element will be presented below the first one.
However, the latter element will not cross over to the previous element, such as the fourth block element, but the third one will not be suspended. The fourth season block element remains in its original position.
<style> .first-one{ float:left; background-color:green; } .second-one{ background-color:purple; } .third-one{ background-color:blue; } .fourth-one{ float:left; background-color:grey; } div{ width:200px; height:200px; background-color: pink; border:1px solid black; font-size:30px; } </style><body> <div class= first-one></div> <div class= second-one></div> <div class= third-one></div> <div class= fourth-one></div> <div class= fourth-one></div></body>The third phenomenon:
If all elements float and the remaining width of the parent element is not enough to support the arrangement of the child elements in that row, then it will be connected to the upper level
This article is reproduced from: https://segmentfault.com/a/1190000022669455
SummarizeThis is the end of this article about a brief analysis of the usage of HTML floating float. For more related html floating float content, please search for previous articles from Wulin.com or continue to browse the related articles below. I hope everyone will support Wulin.com in the future!