首页 > Web开发 > 详细

html5语义化标签

时间:2015-12-14 06:42:59      阅读:205      评论:0      收藏:0      [点我收藏+]

最近,想提高代码的识别度,学习了一下html5语义化标签。

   HTML5 可以让很多更语义化的结构化代码标签代替大量的无意义的 div 标签。这种语义化的特性不仅提升了网页的质量和语义,并且减少了以前用于CSS 调用的class 和 id 属性。

html5常用结构标签: header,nav,body,article,section,aside,hgroup,figure,figcaption,footer

<article> 标签定义外部的内容,可以是一篇新的文章。

<aside> 标签定义 article 以外的内容,aside 的内容可用作文章的侧边栏。

<figcaption> 标签定义 figure 元素的标题。

<figure> 标签用于对元素进行组合,使用 figcaption 元素为元素组添加标题。

<footer> 标签定义 section 或 文档 的页脚。

<header> 标签定义 文档 的页眉。

<hgroup> 标签用于对 section 或 网页 的标题进行组合,使用 figcaption 元素为元素组添加标题。

<nav> 标签定义 导航链接 的部分。

<section> 标签定义文档中的节( section、区段 )。比如章节、页眉、页脚或文档中的其他部分。

<time> 标签定义日期或时间,或者两者。

<!doctype html>
<html>
<head>
<meta charset = "utf-8">
<title>html5结构标签让页面布局更语义化</title>
<style>
body,div{margin:0px;padding:0px;}
.clear:after{ visibility:hidden; display:block;font-size:0; content:"."; clear:both;height:0;}  * html .clear{zoom:1;clear:both;}
*:first-child+html .clear{zoom:1;clear:both;} 
.clear{ zoom:1; clear:both;}
header{border:1px solid green;margin:5px auto;width:80%;height:100px;background:#abcdef;}
header nav{border:1px solid black;height:100px;line-height:100px;text-align:center;font-size:30px;color:green;}
.container{border:1px solid green;width:80%;height:auto;margin:5px auto;background:#abcdef;}
.container section{width:65%;border:1px solid black;height:450px;text-align:center;font-size:30px;color:green;line-height:450px;float:left;background:#abcdef;}
.container aside{width:32%;border:1px solid black;height:450px;line-height:450px;text-align:center;font-size:30px;color:green;float:right;background:#abcdef;}
footer{border:1px solid green;width:80%;height:100px;line-height:100px;text-align:center;font-size:30px;color:green;margin:5px auto;background:#abcdef;}
</style>
</head>
<body>
<header>
<nav>header</nav>
</header>
<div class="container clear">
<section>section</section>
<aside>aside</aside>
</div>
<footer> footer</footer>
</body>
</html>

  

html5语义化标签

原文:http://www.cnblogs.com/gantang/p/5044011.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!