css set float and clear float

http://www.divcss5.com/jiqiao/j406.shtml

 

 

https://my.oschina.net/leipeng/blog/221125

 

 
First correction a little clear is not a tag, it's an attribute in css.
Its property value has four clear:both|left|right|none;
Simply put, the role of the clear property is to "clear" the float.
If an element is set to clear:left; it means that there is no floating element to the left of the element
Correspondingly, clear:right; indicates that there are no floating elements on the right side of the element; clear:both; indicates that there are no floating elements on both sides of the element. clear:none indicates that floating elements are allowed on both sides.

Visually, if there is no floating element on the left or right of an element, only it can move down one line, or the floating element can move down one line. (This element must not be able to clear the floating element, just use this method to achieve the effect of page layout )
The floating element is the element with the float attribute set.

clear:left|right|both will be used
I don't know if you have encountered this situation:
Four divs, I want them to be displayed in two lines, I usually do this
<div style="float:left;"></div><div style="float:left;"></div>
<div style="float:left;clear:left;"></div><div style="float:left;"></div>
or
<div style="float:left;"></div><div style="float:left;clear:right;"></div>
<div style="float:left;"></div><div style="float:left;"></div>

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327101284&siteId=291194637