固定宽高度,让上传的图片不变形
<style type="text/css"> .img-responsive { max-width: 100%; height: 0; padding-bottom: 40%; //div大小的比例 background-color:#ff0000; overflow: hidden; } .img-responsive img { width: 100%; } </style> <div class="img-responsive"> <img src="http://d13yacurqjgara.cloudfront.net/users/14765/screenshots/1392915/mrbc-badge-....png" /> </div>