36. If you want multiple blocks to appear in the same row, you can set the blocks to float and float in the same direction.
37. Clear Floating
When the element has a floating property, it will affect its parent element or subsequent elements, there will be a layout disorder, you can clear the floating method to solve,
Impact of floating elements
Floating Cleanup (Clear):
None: Default value. Allowed to have floating objects on both sides
Left: does not allow floating objects
Right: Do not allow floating objects
Both: Floating objects are not allowed on the left and right sides
38, floating floating, first floating after moving, floating objects, will first float up, leaving the original position. The back movement is the object behind it, moving up to its original position.
39, the height of the parent element does not increase automatically when the parent element does not specify a height, and if its child elements are floating.
40, the method of clearing floating
1), additional labeling method:
This method should be said to be the simplest one, the proposal is to add a "clear:both" element at the end of the container, forcing the container to adapt to its height in order to install the
Some float elements. Disadvantage: Code will be added.
<div id= "Main" >
<div id= "left" > Box </div>
<div id= "Right" > Box </div>
<div class= "Clear" ></div> add an empty div
</div>
<div id= "Footer" > Bottom </div>
2), the parent element uses the overflow method:
Setting the parent element overflow value to hidden is the simplest way to clear the float, but it can be difficult to implement if the child element uses a positioning layout
*{margin:0padding:0;}
#main, #footer {margin:0 auto;}
#main {width:800px;background: #CCC; overflow:hidden;zoom:1;position:relative;}
#left {width:200px;height:200px;background:blue;position:absolute;left:-100px;top:100px;}
#right {width:300px;height:300px;background:green;float:right;}
#footer {width:800px;height:50px;background:red;}
3), using pseudo-object after method:
A class that uses pseudo-objects after, to control the impact of floating elements.
The most popular clear floating code on the Web:
. clearfix:after{
Clear:both;
Display:block;
Visibility:hidden;
height:0;
line-height:0;
Content: "";
}
. Clearfix{zoom:1;} /* Resolve IE6/7 compatibility issues */
Zoom only browser support for IE kernel, scale
Functional syntax
Sets or retrieves the scale of an object normal: the default value. Use the actual size of the object
Number: percent | Unsigned floating-point real number. A floating-point real value of 1.0 or a percentage of 100% is equivalent to this property
The normal value of
Zoom:1 solving IE6 Highly adaptive problems
41, the use of overflow in CSS
Function: Sets how content is managed when the object's content exceeds its specified height and width
Syntax: overflow:visible[default value. Do not cut content or add scroll bars],auto[The content will be cropped or displayed when required),
hidden[do not display content beyond the object size],scroll[always show scroll bars]
42, positioning: Position
Property: Position
Description: Set how objects are positioned
Value: Static anchor: The default value for each object in the page.
Absolute absolute positioning: separates an object from the document flow, and is determined by setting the Left,right,top,bottom four directions relative to the parent object
-bit If no such parent object exists, then the body object is based.
Relative relative positioning: the object is not detached from the document stream and is positioned relative to its position by setting the Left,right,top,bottom four directions.
* * When using absolute positioning, there must be two conditions
A, the parent element must be positioned to attribute, it is generally recommended to use position:relative;
b, to the child elements, plus absolute positioning position:absolute, but also to add directional properties.
43. The difference between relative positioning and absolute positioning
Absolute positioning is the parent element that is the datum point and is positioned. ---is out of the document flow.
Relative positioning is based on its own reference point. ----Leave the original location, but still occupy the original space.
44, in the IE6 double margin (compatibility problem), the object on the addition of Display:inline; The problem is resolved by becoming an inline element.
CSS Learning notes (3)