DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> HTML基礎知識 >> HTML5教程 >> HTML5 語義化結構化規范化
HTML5 語義化結構化規范化
編輯:HTML5教程     

 HTML結構更加清晰、規范,學習HTML5優化結構的思路。

HTML 5 添加了一些新元素,用來標識常用的結構,是html更具語義化,可是我們無法直接使用,即使可能用到還要等他個十年八年的。

那就像微格式一樣,使用class代替,或者隨意點,使用id和class名來代替,讓自己的結構更加清晰化,可以推廣為規范,讓團隊協作更加順暢。

一些新增的結構標記

◎ section:這可以是書中的一章或一節,實際上可以是在 HTML 4 中有自己的標題的任何東西
◎ header:頁面上顯示的頁眉;與 head 元素不一樣
◎ footer:頁腳;可以顯示電子郵件中的簽名
◎ nav:指向其他頁面的一組鏈接
◎ article:blog、雜志、文章匯編等中的一篇文章

一些例子

HTML5的文檔結構

<header>...</header>
 <nav>...</nav>
 <article>
 <section> ... </section>
 </article>
 <aside>...</aside>

 <footer>...</footer>

XHTML的文檔結構

<div id="header">header</div>
<div id="nav">nav</div>
<div class="article">
  <div class="section">section</div>
</div>
<div id="aside">aside</div>
<div id="footer">footer</div>

HTML5的圖片結構

<figure id="fig2">
  <legend>Figure 2. Install Mozilla XForms dialog</legend>
  <img alt="A Web site is requesting permission to install the ollowing item: Mozilla XForms 0.7 Unsigned" src="installdialog.jpg" />
</figure>

XHTML的圖片結構

<div class="figure">
  <h4 class="legend">Figure 2. Install Mozilla XForms dialog</h4>
  <img alt="A Web site is requesting permission to install the ollowing item: Mozilla XForms 0.7 Unsigned" src="installdialog.jpg" />
</div>
 
HTML5的加上標記
  
m 元素表示文本被 “加上標志”,但是不一定要強調。可以把它想像成書中突出顯示的一節。
Google 的緩存頁面就是典型的用例。如果鏈接到一個緩存的副本,搜索詞就被加上標志。例如,如果搜索 “Egret”,那麼緩存的 Google 頁面可能像下面這樣:

The Great <m>Egret</m> (also known as the American <m>Egret</m>)  is a large white wading bird found worldwide.The Great <m>Egret</m> flies with slow wing beats. The scientific name of the Great <m>Egret</m> isCasmerodius albus.XHTML的加上標記The Great <span class="m">Egret</span> (also known as the American <span class="m">Egret</span>)  is a large white wading bird found worldwide.The Great <span class="m">Egret</span> flies with slow wing beats. The scientific name of the Great <span class="m">Egret</span> isCasmerodius albus.

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved