I am using bootstrap3 and have DIVs that contain background image. These DIVs are place within columns and I want to center them.
I have the following HTML:
<div id="badges">
<div class="col-xs-6 col-sm-6 col-md-2 col-lg-2 badge-container center-block">
<div id="badge1" class="center-block"></div>
</div>
<div class="col-xs-6 col-sm-6 col-md-2 col-lg-2 badge-container center-block">
<div id="badge2" class="center-block"></div>
</div>
<div class="col-xs-6 col-sm-6 col-md-2 col-lg-2 badge-container center-block">
<div id="badge3" class="center-block"></div>
</div>
<div class="col-xs-6 col-sm-6 col-md-2 col-lg-2 badge-container center-block">
<div id="badge4" class="center-block"></div>
</div>
</div>
Each of my DIVs has a background img (here is my code in LESS)
#badges{
.badge-container{
height: 5em;
#badge1{
height:100%;
width: auto;
background-image: url("images/badge1.JPG");
background-size: contain;
background-repeat: no-repeat;
}
#badge2{
height:100%;
width: auto;
background-image: url("images/badge2.JPG");
background-size: contain;
background-repeat: no-repeat;
}
#badge3{
height:100%;
width: auto;
background-image: url("images/badge3.PNG");
background-size: contain;
background-repeat: no-repeat;
}
#badge4{
height:100%;
width: auto;
background-image: url("images/badge4.JPG");
background-size: contain;
background-repeat: no-repeat;
}
}
}
I have tried to make the divs be centered (also have added class="center-block", but it does not work.
How can I make these DIVs be centered?
Thanks