[英]I want to place my second row div just below the first row div
I have two rows in which in first row I have three div's, third div is having great height. 我有两行,第一行有三个div,第三行有很高的高度。 Where as in second row I have one single div.I just want to place my second row div just below the first row div without using margin top in negative and sequence should be same instead of taking parent div of 1,2 and 4th div.Thank you in advance.
与第二行中的第一个div一样,我只想将第二行div放在第一行div的下方,而不使用负数的margin top,并且顺序应该相同,而不是将父div设为1,2和4 div。先感谢您。
div{ float: left; color: white; text-align: center; font-size: 16px; vertical-align: middle; }
<div style="width:40%;padding:40px;background-color:pink;"> 1 </div> <div style="width:20%;padding:40px;background-color:black;"> 2 </div> <div style="width:20%;padding:40px;background-color:green; height:500px;"> 3 </div> <div style="width:20%;padding:40px;background-color:blue;"> 4 </div>
yahh just add clear both to those div that you want to put down. yahh只需在您要放下的div中添加clear即可。 like
喜欢
<div style="width:20%;padding:40px;background-color:black;clear: both;">2</div>
Maybe you should try a different structure in your divs if you want to achieve that, if I understand correct.. 如果我想正确的话,也许要在div中尝试其他结构。
Create one row with cascading divs for the left-pane and one row for the right-page (third div) 在左窗格中创建一个带有层叠div的行,在右页面中创建一行(第三个div)
<div class="left-pane">
<div style="width:40%;padding:40px;background-color:pink;">1</div>
<div style="width:20%;padding:40px;background-color:black;">2</div>
<div style="width:20%;padding:40px;background-color:blue;">4</div>
</div>
<div class="right-pane">
<div style="width:20%;padding:40px;background-color:green; height:500px;">3</div>
</div>
Let me know if this worked out for you. 让我知道这是否对您有用。 I'll be happy to help.
我很乐意提供帮助。
Finally got the solution by my own. 终于得到了我自己的解决方案。 Thank you guys for your efforts.
谢谢你们的努力。
div{ color: white; text-align: center; font-size: 16px; vertical-align: middle; }
<div style="width:40%;padding:40px;background-color:pink; float:left;"> 1 </div> <div style="width:20%;padding:40px;background-color:black;float:left;"> 2 </div> <div style="width:20%;padding:40px;background-color:green; height:500px;float:right;"> 3 </div> <div style="width:20%;padding:40px;background-color:blue;float:left;"> 4 </div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.