Skip to content

锚点

id创建锚点

使用 属性id可以在页面中创建一个锚点

html
<h2 id="intro">简介</h2>
  • 跳转锚点
html
<a href="#intro">跳到简介</a>

a 创建锚点

a标签也可以创建一个锚点

html
<a name="old"></a>
  • 跳转锚点
html
<a href="#old">跳转</a>

危险

name 已过时,不要再用

锚点命名规范

锚点区分大小写

锚点名在页面中是唯一的

锚点名不要使用数字开头