float float clear float

1. floating elements from the document flow.
2. The floating element fit each other against
the floating element will abut tightly together, if the window is wide enough space behind the floating element, he would next to a front abutment element, if the window is not enough space
to his width, he before will find a previous element against, if not enough to continue a forward looking, will not go beyond the abutment, this arrangement is called the stream's layout.
3. The element has the effect of floating text wrapping,
used in conjunction with graphics.
Clear float;
float element out of the document flow, the document is not in space, leading to the back of the elements will be followed by a position element arranged, our aim is to remove floating
prevent this from happening.
1. The parent element is provided for height.
{UL
List-style: none;
border; Solid Red 1px;
height: 20px;
}
UL {Li

float:left;


}

2. a floating element to the last element plus a blank, set the properties clear: both;


To the floating element 3 is provided a parent type called clearfix

.clearfix: after {// pseudo latter class selector to set a fake parent progeny element

clear: both; Clear float
height: 0;
visibility; hidden;

content:""";内容
Display:block;

}

 

Guess you like

Origin www.cnblogs.com/wzx888/p/11924194.html