[英]CSS Overlay effect on hover not working
Does anyone know why my .cd-img-overlay
class is not working when I hover over a list item? 有人知道我将鼠标悬停在列表项上时为什么我的
.cd-img-overlay
类不起作用吗?
CSS:
CSS:
#cd-team .cd-img-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(92, 75, 81, 0.9);
opacity: 0;
border-radius: .25em .25em 0 0;
-webkit-transition: opacity 0.3s;
-moz-transition: opacity 0.3s;
transition: opacity 0.3s;
}
HTML:
HTML:
<li>
<a href="#0" data-type="member-1">
<figure>
<img src="images/bruce.jpg" alt="Team member 1" />
<div class="cd-img-overlay"><span>View Bio</span></div>
</figure>
<div class="cd-member-info">
John Smith <span>Founder & President</span>
</div>
</a>
</li>
I can't seem to get that overlay class to work like shown in this tutorial's demo when you hover over a team member: https://codyhouse.co/demo/side-team-member-bio/index.html 当您将鼠标悬停在团队成员上时,似乎无法像本教程的演示中所示那样使用该叠加类: https : //codyhouse.co/demo/side-team-member-bio/index.html
Hi change the opacity for the overlay to 1 and you're there. 嗨,将叠加层的不透明度更改为1,就可以了。 :) It's currently set to opacity: 0 for your hover class.
:)当前设置为opacity:悬停类为0。
Do you have a hover state to change the opacity to 1? 您是否具有悬停状态以将不透明度更改为1? For example:
例如:
a:hover .cd-img-overlay { opacity: 1; }
add this to your code an it will work .. its just because on hover you are not changing the opacity to 1. 将此添加到您的代码中,它将可以正常工作..只是因为在悬停时您没有将不透明度更改为1。
#cd-team li:hover .cd-img-overlay {
opacity: 1;
}
You are not changing the opacity to 1 when hovering. 悬停时,您没有将不透明度更改为1。 That's why the problem is.
这就是问题所在。 Use the following code that is present in the working url.
使用工作网址中存在的以下代码。
.no-touch #cd-team li:hover .cd-img-overlay { opacity: 1; }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.