自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

HTML 5深入淺出教學(xué)篇之二

開發(fā) 前端
本文主要講到的是區(qū)塊元素 - body, article, section, header, footer, h1, h2, h3, h4, h5, h6, hgroup, aside, nav, address。

介紹

HTML 5: 區(qū)塊元素

區(qū)塊元素 - body, article, section, header, footer, h1, h2, h3, h4, h5, h6, hgroup, aside, nav, address

示例

1、body - 用于定義文檔的主體element/section/body.html

  1. <!doctype html> 
  2. <html> 
  3. <head> 
  4.     <title>body</title> 
  5. </head> 
  6.  
  7. <!--  
  8.     body - 用于定義文檔的主體。其相關(guān)事件處理屬性如下  
  9. --> 
  10. <body> 
  11.     <script type="text/javascript" defer> 
  12.         var body = document.body;  
  13.  
  14.         body.onafterprint = function () { alert("onafterprint"); };  
  15.         body.onbeforeprint = function () { alert("onbeforeprint"); };  
  16.         body.onbeforeunload = function () { alert("onbeforeunload"); };  
  17.         body.onblur = function () { alert("onblur"); };  
  18.         body.onerror = function () { alert("onerror"); };  
  19.         body.onfocus = function () { alert("onfocus"); };  
  20.         body.onhashchange = function () { alert("onhashchange"); };  
  21.         body.onload = function () { alert("onload"); };  
  22.         body.onmessage = function () { alert("onmessage"); };  
  23.         body.onoffline = function () { alert("onoffline"); };  
  24.         body.ononline = function () { alert("ononline"); };  
  25.         body.onpagehide = function () { alert("onpagehide"); };  
  26.         body.onpageshow = function () { alert("onpageshow"); };  
  27.         body.onpopstate = function () { alert("onpopstate"); };  
  28.         body.onresize = function () { alert("onresize"); };  
  29.         body.onscroll = function () { alert("onscroll"); };  
  30.         body.onstorage = function () { alert("onstorage"); };  
  31.         body.onunload = function () { alert("onunload"); };  
  32.     </script> 
  33. </body> 
  34. </html> 

2、article - 用于定義一段完整且獨(dú)立的內(nèi)容element/section/article.html

  1. <!doctype html> 
  2. <html> 
  3. <head> 
  4.     <title>article</title> 
  5. </head> 
  6. <body> 
  7.     <!--  
  8.         article - 用于定義一段完整且獨(dú)立的內(nèi)容  
  9.     --> 
  10.     <article> 
  11.         我是一段完整且獨(dú)立的內(nèi)容  
  12.     </article> 
  13. </body> 
  14. </html> 

3、section - 用于定義文檔內(nèi)容中的某一部分element/section/section.html

  1. <!doctype html> 
  2. <html> 
  3. <head> 
  4.     <title>section</title> 
  5. </head> 
  6. <body> 
  7.     <article> 
  8.         <!--  
  9.             section - 用于定義文檔內(nèi)容中的某一部分  
  10.         --> 
  11.         <section>我要學(xué)習(xí) html5</section> 
  12.         <section>我要學(xué)習(xí) flash</section> 
  13.         <section>我要學(xué)習(xí) silverlight</section> 
  14.     </article> 
  15. </body> 
  16. </html> 

4、header - 定義文檔的頁(yè)眉element/section/header.html

  1. <!doctype html> 
  2. <html> 
  3. <head> 
  4.     <title>header</title> 
  5. </head> 
  6. <body> 
  7.     <article> 
  8.         <!--  
  9.             header - 定義文檔的頁(yè)眉  
  10.         --> 
  11.         <header>學(xué)什么呢?</header> 
  12.         <section>我要學(xué)習(xí) html5</section> 
  13.         <section>我要學(xué)習(xí) flash</section> 
  14.         <section>我要學(xué)習(xí) silverlight</section> 
  15.     </article> 
  16. </body> 
  17. </html> 

5、footer - 定義文檔的頁(yè)腳element/section/footer.html

  1. <!doctype html> 
  2. <html> 
  3. <head> 
  4.     <title>footer</title> 
  5. </head> 
  6. <body> 
  7.     <article> 
  8.         <header>學(xué)什么呢?</header> 
  9.         <section>我要學(xué)習(xí) html5</section> 
  10.         <section>我要學(xué)習(xí) flash</section> 
  11.         <section>我要學(xué)習(xí) silverlight</section> 
  12.         <!--  
  13.             footer - 定義文檔的頁(yè)腳  
  14.         --> 
  15.         <footer>作者:webabcd</footer> 
  16.     </article> 
  17. </body> 
  18. </html> 

6、h1 h2 h3 h4 h5 h6 - 用于定義 6 種不同級(jí)別的標(biāo)題,h1 為最大標(biāo)題,h6 為最小標(biāo)題element/section/h1_h2_h3_h4_h5_h6.html

  1. <!doctype html> 
  2. <html> 
  3. <head> 
  4.     <title>h1 h2 h3 h4 h5 h6</title> 
  5. </head> 
  6. <body> 
  7.     <article> 
  8.         <header> 
  9.             <!--  
  10.                 h1 h2 h3 h4 h5 h6 - 用于定義 6 種不同級(jí)別的標(biāo)題,h1 為最大標(biāo)題,h6 為最小標(biāo)題  
  11.             --> 
  12.             <h6>學(xué)什么呢?</h6> 
  13.         </header> 
  14.         <section>我要學(xué)習(xí) html5</section> 
  15.         <section>我要學(xué)習(xí) flash</section> 
  16.         <section>我要學(xué)習(xí) silverlight</section> 
  17.         <footer>作者:webabcd</footer> 
  18.     </article> 
  19. </body> 
  20. </html> 

7、hgroup - 用于對(duì)文檔某段內(nèi)容的標(biāo)題進(jìn)行組合,使用 h1 h2 h3 h4 h5 h6 來標(biāo)記標(biāo)題的級(jí)別element/section/hgroup.html

  1. <!doctype html> 
  2. <html> 
  3. <head> 
  4.     <title>hgroup</title> 
  5. </head> 
  6. <body> 
  7.     <article> 
  8.         <header> 
  9.             <h6> 
  10.                 學(xué)什么呢?  
  11.             </h6> 
  12.         </header> 
  13.         <!--  
  14.             hgroup - 用于對(duì)文檔某段內(nèi)容的標(biāo)題進(jìn)行組合,使用 h1 h2 h3 h4 h5 h6 來標(biāo)記標(biāo)題的級(jí)別  
  15.         --> 
  16.         <hgroup> 
  17.             <h1>webabcd 文章</h1> 
  18.             <h2>談?wù)剬W(xué)習(xí)</h2> 
  19.         </hgroup> 
  20.         <section>我要學(xué)習(xí) html5</section> 
  21.         <section>我要學(xué)習(xí) flash</section> 
  22.         <section>我要學(xué)習(xí) silverlight</section> 
  23.         <footer>作者:webabcd</footer> 
  24.     </article> 
  25. </body> 
  26. </html> 

8、aside - 用于定義文檔以外的,但卻與文檔相關(guān)的內(nèi)容element/section/aside.html

  1. <!doctype html> 
  2. <html> 
  3. <head> 
  4.     <title>aside</title> 
  5. </head> 
  6. <body> 
  7.     <article> 
  8.         <header> 
  9.             <h6> 
  10.                 學(xué)什么呢?  
  11.             </h6> 
  12.         </header> 
  13.         <hgroup> 
  14.             <h1>webabcd 文章</h1> 
  15.             <h2>談?wù)剬W(xué)習(xí)</h2> 
  16.         </hgroup> 
  17.         <section>我要學(xué)習(xí) html5</section> 
  18.         <section>我要學(xué)習(xí) flash</section> 
  19.         <section>我要學(xué)習(xí) silverlight</section> 
  20.         <footer>作者:webabcd</footer> 
  21.         <!--  
  22.             aside - 用于定義文檔以外的,但卻與文檔相關(guān)的內(nèi)容  
  23.         --> 
  24.         <aside> 
  25.             我還寫了好多其他文章  
  26.         </aside> 
  27.     </article> 
  28. </body> 
  29. </html> 

9、nav - 用于定義導(dǎo)航鏈接(nav 是 navigation 的縮寫)element/section/nav.html

  1. <!doctype html> 
  2. <html> 
  3. <head> 
  4.     <title>nav</title> 
  5. </head> 
  6. <body> 
  7.     <article> 
  8.         <header> 
  9.             <h6> 
  10.                 學(xué)什么呢?  
  11.             </h6> 
  12.         </header> 
  13.         <hgroup> 
  14.             <h1>webabcd 文章</h1> 
  15.             <h2>談?wù)剬W(xué)習(xí)</h2> 
  16.         </hgroup> 
  17.         <section>我要學(xué)習(xí) html5</section> 
  18.         <section>我要學(xué)習(xí) flash</section> 
  19.         <section>我要學(xué)習(xí) silverlight</section> 
  20.         <footer>作者:webabcd</footer> 
  21.         <aside> 
  22.             <!--  
  23.                 nav - 用于定義導(dǎo)航鏈接(nav 是 navigation 的縮寫)  
  24.             --> 
  25.             <nav><a href="http://webabcd.cnblogs.com/" target="_blank">我還寫了好多其他文章,單擊這里查看</a></nav> 
  26.         </aside> 
  27.     </article> 
  28. </body> 
  29. </html> 

10、address - 定義文檔作者的聯(lián)系信息element/section/address.html

  1. <!doctype html> 
  2. <html> 
  3. <head> 
  4.     <title>address</title> 
  5. </head> 
  6. <body> 
  7.     <article> 
  8.         <header> 
  9.             <h6> 
  10.                 學(xué)什么呢?  
  11.             </h6> 
  12.         </header> 
  13.         <hgroup> 
  14.             <h1>webabcd 文章</h1> 
  15.             <h2>談?wù)剬W(xué)習(xí)</h2> 
  16.         </hgroup> 
  17.         <section>我要學(xué)習(xí) html5</section> 
  18.         <section>我要學(xué)習(xí) flash</section> 
  19.         <section>我要學(xué)習(xí) silverlight</section> 
  20.         <footer> 
  21.             <!--  
  22.                 address - 定義文檔作者的聯(lián)系信息  
  23.             --> 
  24.             <address> 
  25.                 作者:webabcd,我的電話:911  
  26.             </address> 
  27.         </footer> 
  28.         <aside> 
  29.             <nav><a href="http://webabcd.cnblogs.com/" target="_blank">我還寫了好多其他文章,單擊這里查看</a></nav> 
  30.         </aside> 
  31.     </article> 
  32. </body> 
  33. </html> 

[源碼下載]

原文鏈接:http://www.cnblogs.com/webabcd/archive/2011/09/19/2180990.html

責(zé)任編輯:張偉 來源: webabcd的博客
相關(guān)推薦

2012-05-31 09:35:43

HTML5

2012-05-30 15:17:54

HTML5

2012-05-30 14:51:09

HTML5

2012-05-31 09:19:22

HTML5

2012-05-31 10:57:06

HTML5

2012-05-30 13:17:46

HTML5

2012-05-30 13:49:52

HTML5

2012-05-30 13:26:12

HTML5

2012-05-30 10:52:09

HTML5

2012-05-31 09:54:13

HTML5

2016-10-14 14:32:58

JavascriptDOMWeb

2022-02-25 08:54:50

setState異步React

2011-07-04 10:39:57

Web

2021-03-16 08:54:35

AQSAbstractQueJava

2022-09-26 09:01:15

語(yǔ)言數(shù)據(jù)JavaScript

2012-02-07 15:29:17

Android核心組件Service

2021-08-24 06:36:02

DDD領(lǐng)域驅(qū)動(dòng)微服務(wù)

2017-07-02 18:04:53

塊加密算法AES算法

2019-01-07 15:29:07

HadoopYarn架構(gòu)調(diào)度器

2021-07-20 15:20:02

FlatBuffers阿里云Java
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)