html - CSS: Make img fit completely in div -
working on news site , once mobile, i'd image fits inside entire width of div....whatever might be. images 240px in width talking bumping them up. i'm using:
.thumb { float: left; clear: both; width: 100%; height: auto; margin: 0; } .thumb img { max-width: 100%; max-height: 100%; } so on iphone, pic little bit small since div 320px , img 240. of course, change say, landscape @ 480px example. needs flexible. suggestions?
you might try following, set image width 100%.
.thumb { float: left; clear: both; width: 100%; height: auto; margin: 0; } .thumb img { width: 100%; } <div class="thumb"> <img src="http://placehold.it/200x100"> </div>
Comments
Post a Comment