gpt4 book ai didi

html - 位置静态被破坏

转载 作者:太空宇宙 更新时间:2023-11-04 07:27:12 24 4
gpt4 key购买 nike

我制作了一个简单的网页并且运行良好,但是由于某种原因,如果我想将 css 中的位置从固定更改为静态,网页就会完全损坏。

我已经尝试过更改 HTML 中的顺序,但它似乎也不起作用...

可能出错的代码在这里:

* {
box-sizing: border-box;
}

body{
overflow-x: hidden;
}

.v-header {
height: 100vh;
display: flex;
align-items: center;
color: #fff;
}

.container {
max-width: 960px;
padding-left: 1rem;
padding-right: 1rem;
margin: auto;
text-align: center;
}

.fullscreen-video-wrap{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100vh;
overflow: hidden;
}

.fullscreen-video-wrap video {
min-height: 100%;
min-width: 100%;
}

.header-overlay {
height: 100vh;
position: absolute;
top: 0;
left: 0;
width: 100vw;
z-index: 1;
background: #225470;
opacity: 0.85;
}

.header-content {
z-index: 2;
display: block;
margin-left: auto;
margin-right: auto;
}

.header-content h1{
font-size: 50px;
margin-bottom: 0;
}

.header-content p {
font-size: 1.5rem;
display: block;
padding-bottom: 2rem;
}

button {
background: #34b3a0;
color: #fff;
font-size: 1.2rem;
padding: 1rem 2rem;
text-decoration: none;
}

.section {
padding: 20px 0;
}

.section-b {
background: #333;
color: #fff;
}

@media(max-width:960px) {
.container {
padding-right: 3rem;
padding-left: 3rem;
}
}

nav {
position: fixed;
z-index: 3;
background-color: #005EFF;
}

.w3-content {
z-index: 2;
}

有关更多详细信息和其余代码,这是一个 codepen.io 链接:https://codepen.io/anon/pen/WzWvMP

谢谢,
米格尔

最佳答案

如果你只想改变导航,改变到绝对位置就可以了。

当静态时,它会进入容器,当绝对时,它会扩散。

关于html - 位置静态被破坏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49784286/

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