【问题标题】:Disable link with pointer-events but keep active the :hover event [duplicate]禁用与指针事件的链接,但保持活动:悬停事件[重复]
【发布时间】:2017-09-14 06:40:41
【问题描述】:
我不想使用属性选择器和pointer-events: disable; 禁用主页中的链接,但我想保持 :hover 效果。
这是 CSS:
Section#thumbnails .thumb a[title="Yorokobu"]{
pointer-events: none !important;
display: block !important;
cursor: default;
}
这个网站:www.rafagarces.com/work
谢谢!
【问题讨论】:
标签:
html
css
wordpress
hover
pointer-events
【解决方案1】:
您可以将:hover 状态添加到父元素。
section#thumbnails .thumb a[title="Yorokobu"] {
pointer-events: none !important;
display: block !important;
cursor: default;
}
section#thumbnails .thumb:hover a[title="Yorokobu"] {
color: red;
}
<section id="thumbnails">
<span class="thumb">
<a title="Yorokobu">
Test
</a>
</span>
</section>
【解决方案2】:
这里是你的答案:
section#thumbnails .thumb a[title="Yorokobu"]:hover {
pointer-events: visible !important;
cursor: auto;
}