无法点击href标记链接[关闭]

问题描述 投票:-3回答:1

我有一个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-main,如下所示:

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

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

html css href
1个回答
1
投票

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

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.