//test.css .index-banner-top { width: 100%; background: url(../imgs/guanyu.png) no-repeat center center; height: 210px; background-size:cover } @media only screen and (max- 640px){ .index-banner-top { height: 100px; } }
//test.html
<div class="index-banner-top"></div>
电脑端显示:
手机端显示: