I’ve got some bootstrap code that produces the image above:
.top-buffer-sma {
margin-top: 22px;
}
.top-buffer-med {
margin-top: 33px;
}
.top-buffer-big {
margin-top: 50px;
}
.img-responsive {
margin: 0 auto;
}
.btn {
height: auto;
width: auto;
background-color: transparent;
background-repeat: no-repeat;
border: none;
cursor: pointer;
overflow: hidden;
outline: none;
background-image: none;
border: 0 none;
}
.btn:focus,
.btn:active:focus,
.btn.active:focus {
outline: 0 none;
border: 0 none;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="row top-buffer-sma">
<div class="btn-group btn-group-justified" role="group">
<div class="btn-group" role="group">
<button onclick="location.href = 'http://steamcommunity.com/groups/BTBGUK';" type="button" class="btn">
<img src="img/steam.png" class="img-responsive" alt="Steam">
</button>
</div>
<div class="btn-group" role="group">
<button onclick="location.href = 'https://www.facebook.com/BackToBasicsGaming?ref=hl';" type="button" class="btn">
<img src="img/facebook.png" class="img-responsive" alt="Facebook">
</button>
</div>
<div class="btn-group" role="group">
<button onclick="location.href = 'https://twitter.com/DanPlanetTerra';" type="button" class="btn">
<img src="img/twitter.png" class="img-responsive" alt="Twitter">
</button>
</div>
<div class="btn-group" role="group">
<button onclick="location.href = 'https://www.youtube.com/channel/UCwNckSSF-y5SAOtLPU6Qfrg?view_as=public';" type="button" class="btn">
<img src="img/youtube.png" class="img-responsive" alt="YouTube">
</button>
</div>
<div class="btn-group" role="group">
<button onclick="location.href = 'https://plus.google.com/u/0/103627402461915246566/posts/p/pub';" type="button" class="btn">
<img src="img/googleplus.png" class="img-responsive" alt="Google+">
</button>
</div>
</div>
</div>
How am I able to make the buttons that contain img
of class img-responsive
to completely wrap their contents (img
) but also reduce the spacing between them?
I want it to be more like:
2
Answers
The major problem is you’re using too many
btn-group
in your html, see this updated snippet:Wrap
button
s inside a flex container and give.btn
classmargin:2px
(2px
as example) &padding:0;
(then adjust space in between withbutton.btn
margin
as desired)