【问题标题】: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;
      }
      

      【讨论】:

      • 这不起作用:/
      猜你喜欢
      • 2013-07-11
      • 2016-08-16
      • 1970-01-01
      • 2017-12-11
      • 2019-04-07
      • 2020-06-19
      • 2012-10-31
      • 2019-10-16
      • 2016-01-28
      相关资源
      最近更新 更多