gpt4 book ai didi

html - Firefox 中的全屏背景图片

转载 作者:行者123 更新时间:2023-11-28 02:09:25 25 4
gpt4 key购买 nike

我有一个覆盖浏览器屏幕整个宽度和高度的背景图像。它适用于 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 .

关于html - Firefox 中的全屏背景图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9278470/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com