简体   繁体   English

在引导程序中的相邻div之间创建间隙

[英]Creating gap between adjacent div in bootstrap

I have created three divs and I am trying to create slight gap between the divs. 我已经创建了三个div,并且试图在div之间创建微小的差距。

This is how it is right now. 现在就是这样。

在此处输入图片说明 I want to create gap here. 我想在这里制造差距。

在此处输入图片说明 Here is the HTML and CSS (the div runs thrice in a loop) 这是HTML和CSS(div循环运行三次)

<div class="album-border col-lg-4" style="margin: 1px 0px;">
    <p>Div</p>
</div>

.album-border {
    border: 1px solid #aaaaaa;
    border-radius: 5px;
}

This is one way you could do it. 这是您可以做到的一种方法。 You can assign a width to .album-border so that it can have some space. 您可以为.album-border分配一个宽度,以便它可以有一些空间。 After that you can wrap them in a div with css properties justify-content: space-between; 之后,您可以将它们包装在具有CSS属性justify-content: space-between;div justify-content: space-between; and display: flex; display: flex; Hope this helps 希望这可以帮助

 .album-border { border: 1px solid #aaaaaa; border-radius: 5px; width: 31%; } .div-wrapper { justify-content: space-between; display: flex; } 
 <div class="div-wrapper"> <div class="album-border col-lg-4" style="margin: 1px 0px;"> <p>Div</p> </div> <div class="album-border col-lg-4" style="margin: 1px 0px;"> <p>Div</p> </div> <div class="album-border col-lg-4" style="margin: 1px 0px;"> <p>Div</p> </div> </div> 

.album-border:not(:first-child) {
    margin-left: 5px
}

This should do it. 这应该做。

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

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