How to create a responsive image that also scales up in Bootstrap 3
Solution 1:
Bootstrap's responsive image class sets max-width
to 100%. This limits its size, but does not force it to stretch to fill parent elements larger than the image itself. You'd have to use the width
attribute to force upscaling.
http://getbootstrap.com/css/#images-responsive
Solution 2:
Sure things!
.img-responsive
is the right way to make images responsive with bootstrap 3
You can add some height rule for the picture you want to make responsive, because with responsibility, width changes along the height, fix it and there you are.
Solution 3:
I had to do a small trick to make the image bigger but keeping it responsive:
@media screen and (max-width: 368px) {
img.smallResolution{
min-height: 150px;
}
}
P.S. The max width can be anything you like.
Solution 4:
If setting a fixed width on the image is not an option, here's an alternative solution.
Having a parent div with display: table & table-layout: fixed. Then setting the image to display: table-cell and max-width to 100%. That way the image will fit to the width of its parent.
Example:
<style>
.wrapper { float: left; clear: left; display: table; table-layout: fixed; }
img.img-responsive { display: table-cell; max-width: 100%; }
</style>
<div class="wrapper col-md-3">
<img class="img-responsive" src="https://www.google.co.uk/images/srpr/logo11w.png"/>
</div>
Fiddle: http://jsfiddle.net/5y62c4af/
Solution 5:
Try the following in your CSS stylesheet:
.img-responsive{
max-width: 100%;
height: auto;
}