【问题标题】:Can't click a href tag link [closed]无法单击href标签链接[关闭]
【发布时间】:2018-06-12 23:28:32
【问题描述】:

我有一个类似于侧边栏菜单的 html 结构:

<div class="sidebar sidebar-main">
   <div class="wk-seller">
      <div class="section">
         <a class="store-name" href="https://booyaa.id/marketplace/seller/feedback/shop/adityathevendor">
         Penilaian                      </a>
      </div>
      <div class="section">
         <a class="store-name" href="https://booyaa.id/marketplace/seller/profile/shop/adityathevendor#return-policy">
         Return Policy                          </a>
      </div>
      <div class="section">
         <a class="store-name" href="https://booyaa.id/marketplace/seller/profile/shop/adityathevendor#shipping-policy">
         Kebijakan Pengiriman                           </a>
      </div>
   </div>
</div>

问题是我像这样将伪元素样式添加到侧边栏主:

.sidebar.sidebar-main:before {
    content: '';
    position: absolute;
    left: 0;
    right: 22px;
    border: solid 1px #dae2e6;
    top: 0;
    bottom: 0;
    border-radius: 2px;
}

它使这个html结构中的a href标签不可点击,我该如何解决这个问题?

【问题讨论】:

  • 它正在工作..
  • 请阅读Something on my web site doesn't work. Can I just paste a link to it?。当外部资源消失或固定时,依赖于外部资源来理解的问题变得毫无用处。创建一个minimal reproducible example 并将其放在问题本身中。
  • 链接是“可点击的” - 在边缘。不过同意@Quentin。
  • 当你给这个规则一个背景色.sidebar.sidebar-main::before你可以看到它在链接的前面。所以你不能点击它们。
  • .sidebar.sidebar-main::before 覆盖该区域。如果您确实需要该伪元素,请确保将 pointer-events: none; 添加到其 CSS 以使其点击。

标签: html css href


【解决方案1】:

您有一个伪元素.sidebar.sidebar-main::before 覆盖该区域。如果您确实需要该伪元素,请确保将 pointer-events: none; 添加到其 CSS 以使其点击。

【讨论】:

  • 感谢学习新元素
猜你喜欢
  • 1970-01-01
  • 2015-12-12
  • 2018-02-08
  • 1970-01-01
  • 2019-01-31
  • 1970-01-01
  • 1970-01-01
  • 2014-05-26
  • 1970-01-01
相关资源
最近更新 更多