【问题标题】:href link not clickable (appears to work in chrome inspect)href 链接不可点击(似乎在 chrome 检查中工作)
【发布时间】:2020-03-16 19:25:42
【问题描述】:

希望大家帮忙。我目前正在学习 HTML 和 CSS 的在线课程。作为我课程的一部分,我正在练习制作网页。我遇到了标题 href 的问题。

我正在尝试从标题链接到正文中的某个位置。但是,当我在 chrome 上进行测试时,它不会显示为超链接。使用 chrome 的检查功能将其显示为链接,单击时它可以工作。但是它在检查之外不起作用。

我的 HTML 如下:

<!DOCTYPE html>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" type="text/css" href="landing.css">
</head>
<header>
    <h1>
        Heading
    </h1>
    <h2>Services <a href="#services_section"></a></h2>
    <div class="tag-line">
    </div>
</header>
<body>
<h3>
    About
</h3>
    <div class="about">     
<h4 id="services_section">
    <div class="services">
    Services
</h4>
<h5>
    <div class="contact">
    Contact
</h5>
</body>
</html>

【问题讨论】:

  • 如果您要链接到“服务”文本,请使用&lt;a href=...&gt;Services&lt;/a&gt;。当前代码显示文本“服务”,然后在其后显示一个零空间超链接。

标签: html anchor


【解决方案1】:

超链接正常,问题是没有文字。您需要将“服务”放在标签内。

改变

<h2>Services <a href="#services_section"></a></h2>

<h2><a href="#services_section">Services</a></h2>

【讨论】:

  • 非常感谢您解决了这个问题。这帮助我进入下一步并继续学习。
猜你喜欢
  • 2018-02-27
  • 2014-01-22
  • 2012-10-06
  • 1970-01-01
  • 2021-11-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多