首页  >  文章  >  web前端  >  html5语义化标签_html/css_WEB-ITnose

html5语义化标签_html/css_WEB-ITnose

WBOY
WBOY原创
2016-06-24 11:31:591450浏览

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

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

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

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

标签定义 figure 元素的标题。

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

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

标签定义 文档 的页眉。

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

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

<!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>

  

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn