两种方法跳转到锚点:
1、给锚点添加 name 属性和 id 属性。一般只要加 name 就行了,加上 id 是为了兼容其他浏览器。
2、通过 js 方法跳转到锚点
var _id = location.href.split('#')[1];if(_id){ document.getElementById(_id).scrollIntoView(true);}
PS:一般用 name 和 id 就可以了,如果碰到解决不了那就试试用 js 的方法。
查看更多关于【html】关于锚点的一些事_html/css_WEB-ITnose的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did106254