濮阳杆衣贸易有限公司

主頁 > 知識庫 > HTML5的結(jié)構(gòu)和語義(2):結(jié)構(gòu)

HTML5的結(jié)構(gòu)和語義(2):結(jié)構(gòu)

熱門標(biāo)簽:標(biāo)準(zhǔn)智能外呼系統(tǒng) 洛陽市伊川縣地圖標(biāo)注中心官網(wǎng) 電銷機(jī)器人視頻 搜狗星級酒店地圖標(biāo)注 江蘇高頻外呼系統(tǒng)線路 平頂山電子地圖標(biāo)注怎么修改 地圖標(biāo)注自己去過的地方 會(huì)聲會(huì)影怎樣做地圖標(biāo)注效果 高德地圖標(biāo)注錯(cuò)誤怎么修改

  由于缺少結(jié)構(gòu),即使是形式良好的 HTML 頁面也比較難以處理。必須分析標(biāo)題的級別,才能看出各個(gè)部分的劃分方式。邊欄、頁腳、頁眉、導(dǎo)航條、主內(nèi)容區(qū)和各篇文章都由通用的 div 元素來表示。HTML 5 添加了一些新元素,專門用來標(biāo)識這些常見的結(jié)構(gòu):
 · section:這可以是書中的一章或一節(jié),實(shí)際上可以是在 HTML 4 中有自己的標(biāo)題的任何東西
 · header:頁面上顯示的頁眉;與 head 元素不一樣
 · footer:頁腳;可以顯示電子郵件中的簽名
 · nav:指向其他頁面的一組鏈接
 · article:blog、雜志、文章匯編等中的一篇文章
  我們來考慮一個(gè)典型的 blog 主頁,它的頂部有頁眉,底部有頁腳,還有幾篇文章、一個(gè)導(dǎo)航區(qū)和一個(gè)邊欄,見代碼1 典型的 blog 頁面
<html>
<head>
<title>Mokka mit Schlag </title>
</head>
<body>
<div id="page">
<div id="header">
<h1><a href="http://www.elharo.com/blog">Mokka mit Schlag</a></h1>
</div>
<div id="container">
<div id="center" class="column">
<div class="post" id="post-1000572">
<h2><a href=
"/blog/birding/2007/04/23/spring-comes-and-goes-in-sussex-county/">
Spring Comes (and Goes) in Sussex County</a></h2>
<div class="entry">
<p>Yesterday I joined the Brooklyn Bird Club for our
annual trip to Western New Jersey, specifically Hyper
Humus, a relatively recently discovered hot spot. It
started out as a nice winter morning when we arrived
at the site at 7:30 A.M., progressed to Spring around
10:00 A.M., and reached early summer by 10:15. </p>
</div>
</div>
<div class="post" id="post-1000571">
<h2><a href=
"/blog/birding/2007/04/23/but-does-it-count-for-your-life-list/">
But does it count for your life list?</a></h2>
<div class="entry">
<p>Seems you can now go <a
href="http://www.wired.com/science/discoveries/news/
2007/04/cone_sf">bird watching via the Internet</a>. I
haven't been able to test it out yet (20 user
limit apparently) but this is certainly cool.
Personally, I can't imagine it replacing
actually being out in the field by any small amount.
On the other hand, I've always found it quite
sad to meet senior birders who are no longer able to
hold binoculars steady or get to the park. I can
imagine this might be of some interest to them. At
least one elderly birder did a big year on TV, after
he could no longer get out so much. This certainly
tops that.</p>
</div>
</div>
</div>
<div class="navigation">
<div class="alignleft">
<a href="/blog/page/2/">« _fcksavedurl=""/blog/page/2/">«" Previous Entries</a>
</div>
<div class="alignright"></div>
</div>
</div>
<div id="right" class="column">
<ul id="sidebar">
<li><h2>Info</h2>
<ul>
<li><a href="/blog/comment-policy/">Comment Policy</a></li>
<li><a href="/blog/todo-list/">Todo List</a></li>
</ul></li>
<li><h2>Archives</h2>
<ul>
<li><a href='/blog/2007/04/'>April 2007</a></li>
<li><a href='/blog/2007/03/'>March 2007</a></li>
<li><a href='/blog/2007/02/'>February 2007</a></li>
<li><a href='/blog/2007/01/'>January 2007</a></li>
</ul>
</li>
</ul>
</div>
<div id="footer">
<p>Copyright 2007 Elliotte Rusty Harold</p>
</div>
</div>
</body>
</html>
  即使有正確的縮進(jìn),這些嵌套的 div 仍然讓人覺得非?;靵y。在 HTML 5 中,可以將這些元素替換為語義性的元素,見代碼2 用 HTML5編寫的典型blog頁面
<html>
<head>
<title>Mokka mit Schlag </title>
</head>
<body>
<header>
<h1><a href="http://www.elharo.com/blog">Mokka mit Schlag</a></h1>
</header>
<section>
<article>
<h2><a href=
"/blog/birding/2007/04/23/spring-comes-and-goes-in-sussex-county/">
Spring Comes (and Goes) in Sussex County</a></h2>
<p>Yesterday I joined the Brooklyn Bird Club for our
annual trip to Western New Jersey, specifically Hyper
Humus, a relatively recently discovered hot spot. It
started out as a nice winter morning when we arrived at
the site at 7:30 A.M., progressed to Spring around 10:00
A.M., and reached early summer by 10:15. </p>
</article>
<article>
<h2><a href=
"/blog/birding/2007/04/23/but-does-it-count-for-your-life-list/">
But does it count for your life list?</a></h2>
<p>Seems you can now go <a
href="http://www.wired.com/science/discoveries/news/
2007/04/cone_sf">bird watching via the Internet</a>. I
haven't been able to test it out yet (20 user
limit apparently) but this is certainly cool.
Personally, I can't imagine it replacing
actually being out in the field by any small amount.
On the other hand, I've always found it quite
sad to meet senior birders who are no longer able to
hold binoculars steady or get to the park. I can
imagine this might be of some interest to them. At
least one elderly birder did a big year on TV, after
he could no longer get out so much. This certainly
tops that.</p>
</article>
<nav>
<a href="/blog/page/2/">« _fcksavedurl=""/blog/page/2/">«" Previous Entries</a>
</nav>
</section>
<nav>
<ul>
<li><h2>Info</h2>
<ul>
<li><a href="/blog/comment-policy/">Comment Policy</a></li>
<li><a href="/blog/todo-list/">Todo List</a></li>
</ul></li>
<li><h2>Archives</h2>
<ul>
<li><a href='/blog/2007/04/'>April 2007</a></li>
<li><a href='/blog/2007/03/'>March 2007</a></li>
<li><a href='/blog/2007/02/'>February 2007</a></li>
<li><a href='/blog/2007/01/'>January 2007</a></li>
</ul>
</li>
</ul>
</nav>
<footer>
<p>Copyright 2007 Elliotte Rusty Harold</p>
</footer>
</body>
</html>
  現(xiàn)在不再需要 div 了。不再需要自己設(shè)置 class 屬性,從標(biāo)準(zhǔn)的元素名就可以推斷出各個(gè)部分的意義。這對于音頻瀏覽器、手機(jī)瀏覽器和其他非標(biāo)準(zhǔn)瀏覽器尤其重要。
  
  (待續(xù))

標(biāo)簽:鄂爾多斯 果洛 松原 廣西 常德 廣東 蚌埠 阿克蘇

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《HTML5的結(jié)構(gòu)和語義(2):結(jié)構(gòu)》,本文關(guān)鍵詞  HTML5,的,結(jié)構(gòu),和,語義,HTML5,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《HTML5的結(jié)構(gòu)和語義(2):結(jié)構(gòu)》相關(guān)的同類信息!
  • 本頁收集關(guān)于HTML5的結(jié)構(gòu)和語義(2):結(jié)構(gòu)的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    宜君县| 钦州市| 泸溪县| 苏尼特左旗| 遂溪县| 五莲县| 黑山县| 尉犁县| 辰溪县| 安多县| 古丈县| 宁安市| 呼图壁县| 开远市| 连江县| 阿图什市| 南安市| 天气| 成安县| 奉化市| 邹平县| 滨州市| 西峡县| 清新县| 湛江市| 景德镇市| 武陟县| 永春县| 汤阴县| 资阳市| 庆城县| 西宁市| 石首市| 乌海市| 万宁市| 荔浦县| 诸暨市| 成武县| 吴旗县| 青阳县| 湘潭市|