Firefox 中的全屏背景图像

2023-12-01

我有一个覆盖浏览器屏幕的整个宽度和高度的背景图像。它在 Chrome 和 IE 中工作,但在 Firefox 中图像被下推。有什么想法发生了什么吗?

/* CSS */
<style type="text/css">

#bg {
position:fixed;
top:0;
left:-50%;
width:200%;
height:75%;
}
#bg img {
position:absolute;
top:0;
left:0;
right:0;
bottom:0;
margin:auto;
min-width:50%;
min-height:50%;
}

</style>

/* HTML */
<div id="bg">
<img src="http://image.iloqal.com/lib/fe5c1570746107757c1c/m/1/BMW_528_bkg.png" id="back1" alt="" />
</div>

您应该尝试以下方法使图像全屏显示:

html {
    background: url(images/bg.jpg) no-repeat center center fixed;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
}

欲知详情,请看一下here.

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Firefox 中的全屏背景图像 的相关文章