Div floating center single div box and three column layout middle div box floating center method
div floating central single div box and three column layout intermediate box floating center method, in the style, there is no central attribute, if the left middle right layout of the three boxes How do I get the middle div box to be in the middle? How can a single div object achieve the middle layout? The implementation of
one, a single div layout in the middle - TOP
single div object layout is to provide the middle of the margin:0 auto style of the div box.
1, DIV CSS complete code
[code]
.Lt;! DOCTYPE html.gt;
.Lt. 0px; height:80px; border:1px solid #00F}
.Lt; /style.gt;
.Lt; /head.gt;
/>
3, summary, here in order to observe the effect, we add the border, width, height to this case div, and use margin:0 Auto to achieve the center.
4, related CSS div tutorials
1), DIV CSS middle condition
2), CSS mediate middle and middle codes. The left and right div boxes can be left and right by using the float:left to the left and float:right, while the div box in the middle is typesetting in the middle, and float has no middle floating style, only the center layout is implemented through float:left and float:right.
usually set float:left for the most left and middle div to the most right div set float:right to achieve the parallel three column layout, but it is necessary to note that the width of the three box setting width and the width of the CSS border, padding and other styles must be less than or equal to the parent div width of the outer layer, or there will be CSS misplacement compatibility problems . The
three columns are placed side by side. First, the outer layer must set up a div box, and then the object will be arranged with 3 boxes to achieve CSS side by side.
1, complete HTML DIV CSS code as
[code].Lt; O; width:400px; height:120px; border:1px solid #00F}
.Divcss5-l{float:left; width:120px; height:120px; border-right:1px. X; height:120px; border-left:1px solid #00F}
.Lt; /style.gt;
.Lt; /head.gt;
! >.Lt; div class=.quot; divcss5-r.quot;.Gt; right.Lt; /div.gt;
.Lt; /div.gt;
.Lt; V uses floating to implement the center layout effect
note three box width calculations. In our training, the box width calculation technique is particularly illustrated. Here, the middle div box ".Divcss5-c" divcss5 instance uses the float:left implementation for the layout style and the floating style to allow the div box to be in the middle. .
3, online demonstration:
http://www.divcss5.com/yanshi/201312/2013120601/http://d.divcss5.com/divcss5/down/2013120601.zip