html5中文学习网

您的位置: 首页 > html5教程 > 入门教程 » 正文

HTML5实现锚点时请使用id取代name_html5教程技巧

[ ] 已经帮助:人解决问题
点评:HTML5已经去掉name属性,实现锚点时请使用id,下面有个不错的示例支持Chrome,火狐,IE8以上等浏览器,新手朋友们可以学习下哦
HTML5已经去掉name属性,实现锚点时请使用id,实例效果:http://keleyi.com/keleyi/phtml/html5/9.htm 5LeHTML5中文学习网 - HTML5先行者学习网
5LeHTML5中文学习网 - HTML5先行者学习网
支持Chrome,火狐,IE8以上等浏览器。 5LeHTML5中文学习网 - HTML5先行者学习网
5LeHTML5中文学习网 - HTML5先行者学习网
以下是完整代码: 5LeHTML5中文学习网 - HTML5先行者学习网

复制代码
代码如下:
5LeHTML5中文学习网 - HTML5先行者学习网
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 5LeHTML5中文学习网 - HTML5先行者学习网
<html xmlns="http://www.w3.org/1999/xhtml"> 5LeHTML5中文学习网 - HTML5先行者学习网
<head> 5LeHTML5中文学习网 - HTML5先行者学习网
<title>HTML5锚点实例--柯乐义</title><base target="_blank" /> 5LeHTML5中文学习网 - HTML5先行者学习网
<style> 5LeHTML5中文学习网 - HTML5先行者学习网
body{margin:0px;} 5LeHTML5中文学习网 - HTML5先行者学习网
</style> 5LeHTML5中文学习网 - HTML5先行者学习网
</head> 5LeHTML5中文学习网 - HTML5先行者学习网
<body> 5LeHTML5中文学习网 - HTML5先行者学习网
<div id="keleyihead"><a href="http://keleyi.com">柯乐义</a> <a href="http://keleyi.com/a/bjac/hwqa4oex.htm">HTML5锚点</a> keleyi.com5LeHTML5中文学习网 - HTML5先行者学习网
<script type="text/javascript" src="http://keleyi.com/kineryi/js/gggg728x90a.js"></script></div> 5LeHTML5中文学习网 - HTML5先行者学习网
<div style="height:30px;width:100%;text-align:center"><a href="#keleyifoot" target="_self">转到底部</a></div> 5LeHTML5中文学习网 - HTML5先行者学习网
<div style="background-color:#959822; width:100%;height:150px;">请滚动鼠标使页面向下</div> 5LeHTML5中文学习网 - HTML5先行者学习网
<div style="background-color:Green; width:100%;height:150px;">www.keleyi.com</div> 5LeHTML5中文学习网 - HTML5先行者学习网
<div style="background-color:Red; width:100%;height:150px;">欢迎</div> 5LeHTML5中文学习网 - HTML5先行者学习网
<div style="background-color:Yellow; width:100%;height:150px;">hi</div> 5LeHTML5中文学习网 - HTML5先行者学习网
<div style="background-color:Silver; width:100%;height:150px;">5LeHTML5中文学习网 - HTML5先行者学习网
<a href="http://keleyi.com/dev/94fb5964c80ee829.htm" target="_blank">绿色箭头图片返回顶部效果</a> 5LeHTML5中文学习网 - HTML5先行者学习网
<a href="http://keleyi.com/a/bjac/7cc2358ac924ebc5.htm" target="_blank">蓝色方块返回顶部</a> 5LeHTML5中文学习网 - HTML5先行者学习网
<a href="http://keleyi.com/a/bjac/6f008786225269ac.htm" target="_blank">纯文本返回顶部</a> 5LeHTML5中文学习网 - HTML5先行者学习网
<a href="http://keleyi.com/a/bjac/8aa32432160f9aa4.htm" target="_blank">漂亮的返回顶部、底部和留言</a></div> 5LeHTML5中文学习网 - HTML5先行者学习网
<div style="background-color:Aqua; width:100%;height:150px;">keleyi.com</div> 5LeHTML5中文学习网 - HTML5先行者学习网
<div style="background-color:Fuchsia; width:100%;height:150px;">keleyi</div> 5LeHTML5中文学习网 - HTML5先行者学习网
<div style="background-color:Green; width:100%;height:150px;">keleyi.com</div> 5LeHTML5中文学习网 - HTML5先行者学习网
<div style="background-color:Blue; width:100%;height:150px;">柯乐义</div> 5LeHTML5中文学习网 - HTML5先行者学习网
<div style="background-color:Olive; width:100%;height:150px;">柯乐义 监视下滚像素</div> 5LeHTML5中文学习网 - HTML5先行者学习网
<div style="background-color:Green; width:100%;height:150px;">keleyi.com</div> 5LeHTML5中文学习网 - HTML5先行者学习网
<div style="background-color:Purple; width:100%;height:150px;">jquery</div> 5LeHTML5中文学习网 - HTML5先行者学习网
<div style="background-color:Green; width:100%;height:150px;"><a href="http://keleyi.com/a/bjac/f4a6f78d74a251c5.htm" target="_blank">原文</a></div> 5LeHTML5中文学习网 - HTML5先行者学习网
<div style="background-color:Lime; width:100%;height:150px;">keleyi.com</div> 5LeHTML5中文学习网 - HTML5先行者学习网
<div style="background-color:Orange; width:100%;height:150px;">完整代码</div> 5LeHTML5中文学习网 - HTML5先行者学习网
<div style="height:200px;width:100%;">HTML5已经去掉name属性,实现锚点时请使用id</div> 5LeHTML5中文学习网 - HTML5先行者学习网
<div id="keleyifoot" style="width:100%;height:276px;background: url(http://keleyi.com/images/footerimg.jpg); background-position:center top; background-repeat:no-repeat;text-align:center;"><a href="#keleyihead" target="_self">回到顶部</a></div> 5LeHTML5中文学习网 - HTML5先行者学习网
</body> 5LeHTML5中文学习网 - HTML5先行者学习网
</html> 5LeHTML5中文学习网 - HTML5先行者学习网
5LeHTML5中文学习网 - HTML5先行者学习网
直接转到页底示例: 5LeHTML5中文学习网 - HTML5先行者学习网
http://keleyi.com/keleyi/phtml/html5/9.htm#keleyifoot5LeHTML5中文学习网 - HTML5先行者学习网
(责任编辑:)
推荐书籍
推荐资讯
关于HTML5先行者 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 人才招聘 - 帮助