I am making a grid with bootstrap 3 there is looking like the below image. It is not possible for me to use Bootstrap 4, since it is a webshop with over 100.000 products, so the backend developers did not change it yet.
My problem is regarding the padding. All around the columns I would like to have a padding:15px;. At the moment I am giving each column the class="top-pad-d". But I am getting problems when I look at a mobile:
So to make my padding work, I now have to make a padding inside a media query, fx with the class="top-pad-m". But it is getting very complicated to control and weird.
For a single column the code will be:
<div class="col-sm-2">
<a href="#"><img src="http://placehold.it/196x210" class="img-responsive top-pad-d top-pad-m"></a>
</div>
Is there a way I can write some code there is saying - around all columns should there be 15px padding?
Please notice that I cannot set padding:15px; on all small columns, since they then will have a padding:30px;, because there is 2 rows on top of each other.
.row [class*="col-"] {
padding-right: 7.5px;
padding-left: 7.5px;
}
.padding-y {
padding: 15px;
background-color: #fff;
margin-bottom:30px;
border: 1px solid #ebecf0;
}
.top-pad-d {
padding-top: 15px;
}
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<script
src="https://code.jquery.com/jquery-3.5.1.js"
integrity="sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc="
crossorigin="anonymous"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<!-- Section 4 -->
<div class="section padding-y">
<div class="row">
<div class="col-sm-4">
<a href="#"><img src="http://placehold.it/400x427" class="img-responsive"></a>
</div>
<div class="col-sm-2">
<a href="#"><img src="http://placehold.it/196x210" class="img-responsive"></a>
</div>
<div class="col-sm-2">
<a href="#"><img src="http://placehold.it/196x210" class="img-responsive"></a>
</div>
<div class="col-sm-2">
<a href="#"><img src="http://placehold.it/196x210" class="img-responsive"></a>
</div>
<div class="col-sm-2">
<a href="#"><img src="http://placehold.it/196x210" class="img-responsive"></a>
</div>
<div class="col-sm-2">
<a href="#"><img src="http://placehold.it/196x210" class="img-responsive column-top-pad"></a>
</div>
<div class="col-sm-2">
<a href="#"><img src="http://placehold.it/196x210" class="img-responsive column-top-pad"></a>
</div>
<div class="col-sm-2">
<a href="#"><img src="http://placehold.it/196x210" class="img-responsive column-top-pad"></a>
</div>
<div class="col-sm-2">
<a href="#"><img src="http://placehold.it/196x210" class="img-responsive column-top-pad"></a>
</div>
</div>
</div>

