简体   繁体   English

如何在引导程序的div列中为div设置边距

[英]How can I set margin for div inside column div in bootstrap

How can I set margin for div inside column div in bootstrap, like in the code I am trying to make margin 5px but it doesnt work! 我如何在引导程序中的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>

Is this what you wanted? 这就是你想要的吗? Check the margin-5 class that is added to one div and not the other so you can see the difference. 检查添加到一个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> 

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

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