简体   繁体   English

如何在第一行制作 3 个 div,在第二行制作 2 个 div?

[英]How can i make 3 div in first row and 2 div in second row?

How can i make 3 div in first row and 2 div in second row?如何在第一行制作 3 个 div,在第二行制作 2 个 div?

This is the current output:这是当前的 output:

这是当前的输出

This is the target output:这是目标 output: 这是目标输出

 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> <div class="gift-div"> <div class="row"> <div class="col-lg-4 col-md-4 col-6 col-padds"> <a href="giftred_detail.php?p="> <div class="div-size" style="background-color:transparent; border: 3px solid white; box-shadow: 0px 0px 70px 5px #FF0000, inset 0px 0px 150px 5px #FF0000;;"> <img src="img/gift/" alt="Item" class="jpo"> </a> <div class="container text-con" style="text-align:center"> <h4><b style="word-break:break-word"></b></h4> <p>Points</p> </div> </div> </div> </div> </div>

You can use CSS flex as well:您也可以使用 CSS flex

 .boxes { display: flex; flex-direction: column; gap: 20px; width: 100%; }.row { display: flex; align-items: center; width: 100%; height: 200px; gap: 50px; flex-direction: row; justify-content: center; }.box { width: 200px; height: 200px; background-color: red; }
 <div class="boxes"> <div class="row"> <div class="box"></div> <div class="box"></div> <div class="box"></div> </div> <div class="row"> <div class="box"></div> <div class="box"></div> </div> </div>

NOTE: THE RESULTS HERE MAY NOT BE ACCURATE DUE TO IFRAME WIDTH注意:由于 IFRAME 宽度,此处的结果可能不准确

Actual results:实际结果:

结果

Fiddle example小提琴示例

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我想将第二行div放在第一行div的正下方 - I want to place my second row div just below the first row 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? 如何将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 我在一行中有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 溢出到下一行? - How do i make the last div in a row overflow into the next row? 我该怎么做 <DIV> 一秒钟以下可见 <DIV> 当我将鼠标悬停在第二个 <DIV> - How can I make one <DIV> visible below a second <DIV> when I hover over the second <DIV> 如何制作两个 <div> ... </div> 在同一行? - How to make two <div>…</div> in the same row? 如何使div跳起来 - How to make a div jump a row 如何使div在同一行中 - how to make to div in same row CSS-如何在第一个div溢出时将第二个div强制到另一行 - CSS - How to force second div to another row when first div overflows
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM