[英]How to positioning divs float left but also to top
How to make Divs inside div float left with no spaces; 如何使Div内部的div向左浮动,没有空格; As you can see on the image have spaces, i am using these codes;
正如你在图像上看到的那样有空格,我正在使用这些代码;
main {position:relative;left:339.5px;top:40px;width:1018px;height:1000px;-webkit-box-shadow:inset 0px 0px 40px;}
main div {float:left;margin:1px;-webkit-box-shadow:inset 0px 0px 20px;}
#div_size1 {width:336px;height:200px;}
#div_size2 {width:336px;height:300px;}
#div_size3 {width:336px;height:100px;}
<main>
<div id="div_size1">
</div>
<div id="div_size2">
</div>
<div id="div_size3">
</div>
<div id="div_size3">
</div>
<div id="div_size3">
</div>
<div id="div_size2">
</div>
<div id="div_size2">
</div>
<div id="div_size1">
</div>
<div id="div_size2">
</div>
<div id="div_size3">
</div>
<div id="div_size3">
</div>
</main>
If you post the HTML as well I can help more. 如果您发布HTML,我可以提供更多帮助。 But it looks like you don't have any floats on the divs you want to float.
但看起来你想要漂浮的div上没有任何花车。
#div_size1 {float:left;width:336px;height:200px;}
#div_size2 {float:left;width:336px;height:300px;}
#div_size3 {float:left;width:336px;height:100px;}
If you change the position to absolute you can change its distance from the top and sides: 如果将位置更改为绝对位置,则可以更改其从顶部和侧面的距离:
main div {
margin:1px;
-webkit-box-shadow:inset 0px 0px 20px;
position:absolute;
left: 0px;
top: 0px;
}
Hope this helps 希望这可以帮助
If you want it fixed and if I was building this layout I would have 2 "colum" Divs. 如果你想要它修复,如果我正在建立这个布局我会有2“colum”Divs。 The first 1 would be 2 boxes wide.
第一个是2盒宽。 And the other one would be 1 box wide.
而另一个则是1盒宽。 Left and Right.
左和右。 The 5 boxes on the right would be in the right column div.
右边的5个框将位于右列div中。 Then with the left column I would further separate that.
然后在左栏中我将进一步分开。 I would put 2 "row" divs.
我会把2“行”div。 The bottom would would have the bottom 1 box (div_size3).
底部将有底部1框(div_size3)。 Then with the top row I would separate that by inserting 2 colum divs.
然后在顶行我将通过插入2个colum div来分隔它。 The left one would have 3 boxes and the right one 2 boxes.
左边有3个盒子,右边有2个盒子。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.