同一页面上的HTML5导航 [英] HTML5 navigation on the same page

查看:61
本文介绍了同一页面上的HTML5导航的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在html5中导航存在问题.我看了很多教程,但我不知道自己在做什么错.我想在同一页面上导航.

I have a problem with navigation in html5. I watched a lot of tutorials and I don't know what I'm doing wrong. I want to navigate on the same page.

<header>
<nav>
  <a href="#top">TOP</a>
  <a href="#middle">MIDDLE</a>
  <a href="#bottom">BOTTOM</a>
</nav>
 </header>
<main>
<article>
  <section><h1><a name="top"></a>TOP</h1>
    <figure>
<img src="1.jpg">
</figure>
  <p>...</p>
</section>

推荐答案

噢,亲爱的...您使用的引号是错误的!

Oh dear... You're using wrong quotes!

< a id ="top"> 替换< a name ="top"> ,它应该可以工作.

Replace <a name="top"> with <a id="top"> and it should work.

  • 第一个错误:使用过时的属性 name 代替了 id .
  • 第二个错误:使用错误的引号,使用" 而不是" .
  • 1st error: using obsolete attribute, name instead of id.
  • 2nd error: using wrong quotes, " instead of ".

这篇关于同一页面上的HTML5导航的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆