gpt4 book ai didi

html - 链接不适用于视差设计

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

我在最终的 div (slide4) 中有一个链接,但它不起作用。我搞砸了 z-index 和定位,但没有用。

这是我第一次搞乱视差设计,我正在使用模板来熟悉它,但我在这方面遇到了障碍,无法弄清楚。

这是代码笔:http://codepen.io/anon/pen/bdGcI

CSS:

 <style type="text/css">

html {
height: 100%;
overflow: hidden;
}

`body {
margin:0;
padding:0;
perspective: 1px;
transform-style: preserve-3d;
height: 100%;
overflow-y: scroll;
overflow-x: hidden;
font-family: Oswald;
}`body {
margin:0;
padding:0;
perspective: 1px;
transform-style: preserve-3d;
height: 100%;
overflow-y: scroll;
overflow-x: hidden;
font-family: Oswald;
}
a:link {
text-decoration: none;
color: #fff;
}

a:visited {
text-decoration: none;
color: #ccc;
}

a:hover {
text-decoration: underline;
color: #B22222;
}

a:active {
text-decoration: underline;
}

h1 {
font-size: 550%
}

h2 {
font-size: 250%
}

p {
font-size: 140%;
line-height: 150%;
color: #333;
}
p2 {
font-size: 300%;
line-height: 150%;
color: #fff;
}

.slide {
position: relative;
padding: 25vh 10%;
min-height: 100vh;
width: 100vw;
box-sizing: border-box;
box-shadow: 0 -1px 10px rgba(0, 0, 0, .7);
transform-style: inherit;
}

img {
position: absolute;
top: 50%;
left: 35%;
width: 320px;
height: 240px;
transform: translateZ(.25px) scale(.75) translateX(-94%) translateY(-100%) rotate(2deg);
padding: 1px;
border-radius: 10px;
background: rgba(240,230,220, .7);
box-shadow: 0 0 1px rgba(0, 0, 0, .7);
}

img:last-of-type {
transform: translateZ(.4px) scale(.6) translateX(-104%) translateY(-40%) rotate(-5deg);
}

.slide:before {
content: "";
position: absolute;
top: 0;
bottom: 0;
left:0;
right:0;
}

.title {
width: 50%;
padding: 2%;
border-radius: 5px;
background: rgba(240,230,220, .7);
box-shadow: 0 0 8px rgba(0, 0, 0, .7);
}

.slide:nth-child(2n) .title {
margin-left: 0;
margin-right: auto;
}

.slide:nth-child(2n+1) .title {
margin-left: auto;
margin-right: 0;
}

.slide, .slide:before {
background: 50% 50% / cover;
}

.header {
text-align: center;
font-size: 175%;
color: #fff;
text-shadow: 0 4px 4px #000;
}
.header2 {
text-align: center;
font-size: 175%;
color: #fff;

}

#title {
background-image: url("bg2");
background-attachment: fixed;
}

#slide1:before {
background-image: url("bg3");
transform: translateZ(-1px) scale(2);
z-index:-1;
}

#slide2 {
background-image: url("bg4");
background-attachment: fixed;
}

#slide3:before {
background-image: url("bgbg");
transform: translateZ(-1px) scale(2);
z-index:-1;
}

#slide4 {
background: #222;
}

</style>
</head>

有问题的 HTML:

    <div id="slide3" class="slide">
<div class="title">
<h2>Music</h2>
<p>words words words.</p>
</div>
</div>

<div id="slide4" class="slide header2">
Final Page <a href="link in question">Link</a>.
</div>

最佳答案

因为 :before 伪类会覆盖您编写的内容

.slide:before {
content: "";
position: absolute;
/*top:0;*/ /*remove this */
bottom: 0;
left:0;
right:0;
}

Code pen Demo

关于html - 链接不适用于视差设计,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26794308/

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