【发布时间】:2017-04-06 10:14:30
【问题描述】:
当我将元素放置在图像上方时,悬停效果停止工作。 知道为什么吗?我正在学习。
我有一些定位元素,在 div 顶部具有不透明度的叠加层,背景图像位于固定位置。
编码整个部分和整个 CSS:
HTML:
<div class="wrapper"> <!-- Global Wrapper -->
<section>
<div class="first-row">
<div class="first-row__overlay">
</div>
<div class="jumbotron">
<h2 class="jumbotron__header">This is the Title</h2>
<p class="jumbotron__text">Lorem text
</p>
<div class="under-line"></div>
</div>
<a href="#" class="my-Btn">START NOW</a>
</div>
</section>
CSS:
* {
margin: 0;
padding: 0;
font-family: 'Arsenal', sans-serif;
}
.wrapper {
margin: 0;
padding: 0;
}
.first-row {
width: 100%;
height: 100vh;
background: url("../images/paradise-1.jpg") no-repeat fixed center center;
background-size: cover;
text-align: center;
position: relative;
top: 0;
left: 0;
z-index: -100;
}
.first-row__overlay {
background-color: rgba(33, 46, 63, 1);
width: 100%;
height: 100vh;
opacity: .35;
position: relative;
top: 0;
left: 0;
z-index: -99;
}
.jumbotron {
width: 50%;
margin: auto;
color: white;
position: relative;
top: -70vh;
z-index: 1;
background-color: rgba(0, 0, 0, 0.3);
}
.under-line {
height: 10px;
width: 0;
margin: auto;
background-color: transparent;
border-bottom: 1px solid white;
transition: 7s ease;
}
.my-Btn {
position: relative;
top: -67vh;
z-index: 99999999;
color: #1d1e1f;
font-weight: 300;
font-size: 1.2em;
padding: 10px 60px;
background-color: #fdfdfe;
border-radius: 30px;
}
.my-Btn:hover {
cursor: pointer;
}
【问题讨论】:
-
请分享您的整个代码。这会很有帮助。或者带有图片和锚链接的部分。
-
我确实通过将锚标记的 html 代码放置在该部分之外来修复。但我仍然想知道为什么
内部的悬停效果不起作用,当我尝试使用 jQuery 定位选择器时也不起作用