简体   繁体   English

如何使用 bootstrap 4 获取这种类型的 div 容器?

[英]How to get this type of div container with bootstrap 4?

I searched about bootstrap container class and it seems to me that by default it comes with this grid.我搜索了 bootstrap 容器类,在我看来,默认情况下它带有这个网格。 But its not giving me all three like shown in this picture its showing me only one when I run this code in browser.但是它没有像这张图片中显示的那样给我所有三个,当我在浏览器中运行这段代码时,它只显示了一个。 I added content inside this.我在里面添加了内容。

<div class="container">
  <!-- Content here -->
</div>

网格正在谈论

You need to learn about bootstrap grid system to do this.您需要了解引导网格系统才能做到这一点。

Code代码

 .row { margin-top: 10px; } .data-row { height: 150px; } .first, .second-1, .second-2 { border: solid 1px #6c757d; border-radius: 5px; padding: 10px; text-align: center; } .first { background-color: #daeeff; } .second-1 { background-color: #957bbe; margin-right: 10px; } .second-2 { background-color: #fae3c4; }
 <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" rel="stylesheet"/> <div class="container"> <div class="row"> <div class="col first"> first </div> </div> <div class="row data-row"> <div class="col-10 second-1"> second </div> <div class="col second-2"> menu </div> </div> </div>

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM