【发布时间】:2018-03-09 19:28:13
【问题描述】:
我很难理解为什么我的 H1 没有出现。它由div 覆盖。奇怪的是,如果我将background 颜色更改为transparent 以外的其他颜色,H1 的父级div 是可见的。
同一div 内的输入标签也始终可见。只有H1 有问题。
这里是代码的链接:H1 does not show up 和代码HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<div class="outerContainer">
<div class="imageSlider">
<div class="overlayShadow"></div>
<div class="content">
<h1> Test </h1>
<input>
</div>
</div>
</div>
</body>
</html>
SCSS:
.outerContainer {
z-index: 1;
overflow: hidden;
height: 80vh;
.imageSlider {
z-index: -1;
height: 80vh;
position: relative;
margin-bottom: 20px;
background-position: center;
background-size: cover;
overflow: hidden;
background-image: url('https://tinypng.com/images/social/website.jpg');
animation: mymove 7s cubic-bezier(0,1,0,.5)infinite;
transform: scale(1.5,1.5);
.overlayShadow {
z-index: -1;
width: 100%;
height: 100%;
position: absolute;
background-color: #000;
animation: darken 7s cubic-bezier(0,1,1,.8) infinite;
}
}
}
@-webkit-keyframes mymove {
0% {
top: 0px;
}
100% {
top: -70px;
}
}
@keyframes mymove {
0% {
top: 0px;
}
100% {
top: -70px;
}
}
@-webkit-keyframes darken {
0% {
opacity: 1;
}
26% {
opacity: 0;
}
90% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@keyframes darken {
0% {
opacity: 1;
}
10% {
opacity: 0;
}
90% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.content {
z-index: 1 !important;
position: absolute !important;
height: 300px !important;
top: 50% !important;
width: 100% !important;
margin: 0 auto !important;
h1 {
font-size: 24px !important;
display: inline-block !important;
z-index: 999 !important;
font-size: 14px !important;
line-height: 1.43 !important;
color: #484848 !important;
}
}
谁能帮我理解为什么会这样?非常感谢。
【问题讨论】:
-
transform: scale(1.5,1.5)可能已将h1移出视口
标签: html css sass css-animations