首页 > 解决方案 > html 导航标签 - 单击页面上的任意位置会打开链接问题

问题描述

我有这段 HTML。

<h4><a href="#">MERN-Shopping-List</a></h4>

如果我们忽略 ,#因为我知道放在那里的任何链接只会导致我能够单击页面上的任何位置并转到它,这不是我想要实现的。

这段 HTML 在里面:

<div class="row align-items-center no-gutters mb-4 mb-lg-5">
  <div class="col-xl-8 col-lg-7">
    <img class="img-fluid mb-3 mb-lg-0" src="img/mern.png" alt="">
  </div>
  <div class="col-xl-4 col-lg-5">
    <div class="featured-text text-center text-lg-left">
      <h4><a href="#">MERN-Shopping-List</a></h4>
      <p class="text-black-50 mb-0">This application allows you to register, log in, and log out users and be able to add and delete items to the list. This shopping list was built with the MERN stack with Redux.</p>
    </div>
  </div>
</div>

我已将锚标记放在正确的h4标记内,那么为什么允许我单击任意位置并且仍然能够转到该链接?

我还有其他h4标签也需要附加单独的链接。

标签: htmlanchorhtml-heading

解决方案


推荐阅读