html - How to keep size of images same which have different proportions? -
i have product page, 4 bootstrap columns. adding products through cms editor. below html structure of single product. now, images of products have different proportions. when added them, displayed different height , width. how keep them in same size, in different size of screen.
<div class="row"> <div class="col-sm-3"> <p> <img src="powerabwheel.jpg" alt="powerabwheel.jpg" style="display:block; margin: auto;"> </p> <p style="text-align: center;"><strong>power ab wheel<br></strong> <strong>price:</strong> <a href="# style="font-size: 20px;">$37.95</a></p> </div> </div>
here snapshot of page
hopefully images of same proportion. limit images max-height
, max-width
!
.grid {display: block; overflow: hidden; margin: 0; padding: 0; list-style: none;} .grid li {width: 32%; float: left; margin: 0.5%; height: 80px; display: block; background: #ccf;} .grid li img {max-width: 100%; max-height: 75px; border: 1px solid #999; display: block; margin: 2px auto;}
<h3>same proportions</h3> <ul class="grid"> <li><img src="http://placehold.it/350x150" alt=""></li> <li><img src="http://placehold.it/700x300" alt=""></li> <li><img src="http://placehold.it/175x75" alt=""></li> <li><img src="http://placehold.it/700x300" alt=""></li> <li><img src="http://placehold.it/700x300" alt=""></li> </ul> <h3>different proportions</h3> <ul class="grid"> <li><img src="http://placehold.it/350x150" alt=""></li> <li><img src="http://placehold.it/300x300" alt=""></li> <li><img src="http://placehold.it/175x750" alt=""></li> <li><img src="http://placehold.it/500x320" alt=""></li> <li><img src="http://placehold.it/750x100" alt=""></li> </ul>
Comments
Post a Comment