I have three items enclosed in a container with a background color and padding applied. However, when I try to add margin between them, the elements shift to the next row.
.div-category{
background-color: #2274A5;
padding-left: 50px;
padding-right: 50px;
padding-top: 50px;
padding-bottom: 100px;
border-radius: 3px;
box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.14);
color: whitesmoke;
//margin-right: 10px; Causes line break.
}
@import url('https://fonts.googleapis.com/css?family=Baloo+Bhaina');
/* GLOBAL STYLES
-------------------------------------------------- */
body {
padding-top: 3rem;
padding-bottom: 3rem;
color: #231123;
background-color: #F4E04D;
}
/* MARKETING CONTENT
-------------------------------------------------- */
.marketing .col-lg-4 {
margin-bottom: 1.5rem;
text-align: center;
}
.marketing h2 {
font-weight: 400;
}
.marketing .col-lg-4 p {
margin-right: .75rem;
margin-left: .75rem;
}
.div-category{
background-color: #2274A5;
padding-left: 50px;
padding-right: 50px;
padding-top: 50px;
padding-bottom: 100px;
border-radius: 3px;
box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.14);
color: whitesmoke;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container marketing">
<div class="row">
<div class="col-lg-4 div-category">
<img class="rounded-circle" src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" alt="Generic placeholder image" width="140" height="140">
<h2>Text1</h2>
<p>Paragraph1 </p>
<p><a class="btn btn-secondary" href="#" role="button">View details »</a></p>
</div><!-- /.col-lg-4 -->
<div class="col-lg-4 div-category">
<img class="rounded-circle" src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" alt="Generic placeholder image" width="140" height="140">
<h2>Text2</h2>
<p>Paragraph2.</p>
<p><a class="btn btn-secondary" href="#" role="button">View details »</a></p>
</div><!-- /.col-lg-4 -->
<div class="col-lg-4 div-category">
<img class="rounded-circle" src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" alt="Generic placeholder image" width="140" height="140">
<h2>Text3</h2>
<p>Paragraph3</p>
<p><a class="btn btn-secondary" href="#" role="button">View details »</a></p>
</div><!-- /.col-lg-4 -->
</div><!-- /.row -->
</div>