简体   繁体   English

我想将第二行div放在第一行div的正下方

[英]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.

相关问题 如何在第一行制作 3 个 div,在第二行制作 2 个 div? - How can i make 3 div in first row and 2 div in second row? 如何将div在第二行中直接放在具有相同列大小但被第一行中另一列的高度阻塞的第一行div之下 - How to place div in second row directly under div in first row with same column size but blocked by the height of another column in first row 我希望将第二行的“div”安排在第一行“div”的正下方,但他们的安排留下了空隙 - I want "divs" of second row to be arranged right below first row of "divs" but they getting arranged leaving a gap 为什么我的第一行 DIV 缺少 DIV? - Why is my first row of DIVs missing a DIV? 如何根据CSS中第一行div中孩子的高度动态下推第二行div? - How to dynamically push down a second-row div based on the height of the child in the first row div in CSS? 用class = row操作第二个div - Manipulate second div with class = row 我在一行中有3个div,如何在移动设备中使中间div排在第一位,第二个div排在第一位,第三个div排在最后? - I have 3 divs in one row, how do I get the middle div comes first and first div comes in second and third div comes last in mobile? 我想用div来代替另一个div - I want to show the div in place of the other div 如何将Div放在我的iFrame视频下方 - How to place Div below my iFrame video 我想将弹出式div固定在该位置 - I want to make my popup div fixed to the place
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM