gpt4 book ai didi

html - CSS 背景定位在 safari 和 firefox 中不同

转载 作者:行者123 更新时间:2023-11-28 11:35:41 24 4
gpt4 key购买 nike

我设计了一个由 4 个部分组成的网站主页。顶部、中部 1、中部 2 和底部。每个部分的最小高度为网络浏览器的 100%。顶部有一个带有图像/视频背景的透明背景颜色。

当用户向下滚动时,#videosection 应保留在每个部分的后面,而在 Safari 中,它不会将视频部分保留在其他部分的后面,而 firefox 不会显示视频部分。使用 chrome 一切都很好。

HTML:

<body>
<div id="videosection"><video src=""id="bg-video" muted autoplay loop ></video></div>
<div class="top-section">
</div>
<div class="mid1-section">
<div id="center-box">
<section></section>
</div>
<div class="mid2-section">
<div class="textbanner"><h3>Design</h3></div>
<div class="devices box"><img src=""></div>
</div>
<div class="bottom-section">
<div id="registerform"></div>
</div>
</body>

这是 CSS:

  html, body{
background-color: #ECF0F1;
min-height:100%;
margin: 0;
padding: 0;
}

#videosection {
position: fixed;
top: 0%;
left: 0%;
width: 100%;
height: 100%
z-index: 1;
}

videosection video {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
min-width: 60%;
min-height: 50%; }

.top-section{

background: -webkit-linear-gradient(rgba(255,119,85,0.89), rgba(255,92,106,0.82) ); /* For Safari / background: -o-linear-gradient(rgba(255,119,85,0.89), rgba(255,92,106,0.82)); / For Opera 11.1 to 12.0 / background: -moz-linear-gradient(rgba(255,119,85,0.89), rgba(255,92,106,0.82)); / For Firefox 3.6 to 15 / background: linear-gradient(rgba(255,119,85,0.89), rgba(255,92,106,0.82)); / Standard syntax */ background-repeat: repeat;
position: relative;
top: 0;
left: 0;
min-width: 100%;
min-height: 100%;
z-index: 15;}


#center-column {
position: relative;
margin: 0;
margin-top: 10%;
margin-bottom: 5em;
padding: 0;
}

.mid1-section{
min-height:100%;
width: 100%;
background-color: #ff5b68;
margin: 0;
padding: 0;
text-align: center;
position: relative;
z-index: 15;}

#center-box {
overflow: hidden;
float: none;
text-align: center;
width: 60%;
margin-left: auto;
margin-right: auto;
margin-top: 0;
margin-bottom: 0;}

.mid2-section{
min-height:100%;
width: 100%;
background-color: #3499dc;
margin: 0;
padding: 0;
text-align: center;
position: relative;
z-index: 15;}

.textbanner {
overflow: hidden;
float: none;
height: 20%;
width: 100%;
margin: 0;
padding-top: 3em;
}

section {
overflow: hidden;
text-align: center;
margin: 0;
float: left;
background-color: #ff5b68;
height: 10.5em;
width: 40%;
padding-left: 5%;
padding-right: 5%;
padding-top: 5em;
padding-bottom: 0;
}

.bottom-section{
min-height:100%;
width: 100%;
background-color: #1ABC9C;
margin: 0;
padding: 0;
text-align: center;
position: relative;
z-index: 15;}

#registerform {
background-color: #16A085;
border: 1px solid #16A085;
border-radius: 5px;
width: 420px;
margin-top: 0;
margin-left: auto;
margin-right: auto;
padding: 5%;
}

最佳答案

首先,视频最好放在最后,这样可以提高页面的加载速度。

要使视频落后于其他视频,请在 #videosection 中使用 z-index: -1;

关于html - CSS 背景定位在 safari 和 firefox 中不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20936748/

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