gpt4 book ai didi

css - 如何在 Bootstrap 中的列 div 内设置 div 的边距

转载 作者:太空宇宙 更新时间:2023-11-04 02:15:59 24 4
gpt4 key购买 nike

如何在 bootstrap 中为 div 列内的 div 设置边距,就像在代码中我试图将边距设为 5px 但它不起作用!

<div class="container bg_red">          
<h1>Test DIV boxes</h1>
<div class="row">
<div class="col-md-3 thin_border bg_green">
<div class="bg_blue">
Some content here for panel 1
</div>
</div>
<div class="col-md-9 thin_border">
Some content here for panel 2
</div>
</div>
</div>

最佳答案

这是你想要的吗?检查添加到一个 div 而不是另一个的 margin-5 类,这样您就可以看到区别。

.thin_border {
border: 1px solid #EFEFEF;
}
.margin-5{
margin: 5px;
}
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<div class="container bg_red">
<h1>Test DIV boxes</h1>
<div class="row">
<div class="col-md-3 thin_border bg_green">
<div class="bg_blue margin-5">
Some content here for panel 1
</div>
</div>
<div class="col-md-9 thin_border">
Some content here for panel 2
</div>
</div>
</div>

关于css - 如何在 Bootstrap 中的列 div 内设置 div 的边距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38910067/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com