js或css怎么图片随屏幕分辨率等比例缩放

如题所述

<html>
<head>
<style>
html,body{width:100%;height:100%;margin:auto 0px;padding:auto 0px;text-align:center;}
.imgBox, .imgBox img{width:100%;height:100%;}
</style>
</head>
<body>
<div class="imgBox">
<img src="1.jpg" />
</div>
</body>
</html>

如上代码可以实现,把图片换一下就OK了,希望可以帮到你。

温馨提示:答案为网友推荐,仅供参考
第1个回答  推荐于2017-10-15
function fullScreen(){
$("#container").css({"width":window.screen.width,"height":window.screen.height});
}
$(window).resize(function(){
fullScreen();
});
fullScreen();本回答被提问者和网友采纳

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网