Reputation: 266
I have the following HTML along with twitter bootstrap
<div class="img-container clearfix">
<div class="image">
<img src="/path/to/img.img">
</div>
<div class="image">
<img src="/path/to/img.img">
</div>
<div class="image">
<img src="/path/to/img.img">
</div>
<!-- And so on.... -->
</div>
and following CSS
<style>
div.img-container {
height: 100%;
width: 100%;
}
div.img-container > .image {
width: auto;
height: 50%;
float: left;
padding: 5px;
opacity: 1;
}
div.img-container > .image > img {
max-width: 100%;
max-height: 100%;
}
</style>
The height of the image is getting adjusted to the height of the parent div div.image
, at the same time i want the parent div div.image
to get the same width of the child image, so that all the images look equally spaced.
seems to work ok in chrome, but not working in firefox, below is the link of the same in codepen http://codepen.io/anon/pen/jPwWrV
the following is the screenshot too
Please help me out regarding the same...
Upvotes: 0
Views: 3681
Reputation: 105853
It is a bug that seems to come from padding + bootstrap. remove one or the other and it is gone.
You may set the padding to the inner image :
body {
width: 100%;
height: 200px;
}
div.img-container {
height: 100%;
width: 100%;
}
div.img-container > .image {
height: 50%;
float: left;
opacity: 1;
}
div.img-container > .image > img {
max-height: 100%;
padding: 5px;
}
div {
box-shadow: inset 0 0 0 1px blue, inset 0 0 3px;
}
http://codepen.io/gc-nomade/pen/pJwgRP
Upvotes: 1