css设置图片百分比显示,最简洁的代码
css代码:
.img-box { padding-bottom: 100%; } .img-box img { position: absolute; top: 0; bottom: 0; left: 0; right: 0; width: 100%; /* margin:auto; */ }
html标签:
<div class="img-box"> <img src="image/banner_1_nn.png" /> </div>
本文来自博客园,作者:沉迷编程的程序员,转载请注明原文链接:https://www.cnblogs.com/codeDevotee/p/11412728.html
欢迎各位找我代写程序,python、c#、web等都可以,加我请注明博客园微信:A15919195482