<aside>元素
HTML<aside>元素表示一個(gè)頁(yè)面的一部分, 它的內(nèi)容跟這個(gè)頁(yè)面的其它內(nèi)容的關(guān)聯(lián)性不強(qiáng),或者是沒(méi)有關(guān)聯(lián),單獨(dú)存在。<aside>元素通常顯示成側(cè)邊欄(sidebar)或一些插入補(bǔ)充內(nèi)容。通常用來(lái)在側(cè)邊欄顯示一些定義,比如目錄、索引、術(shù)語(yǔ)表等;也可以用來(lái)顯示相關(guān)的廣告宣傳,作者的介紹,Web應(yīng)用,相關(guān)鏈接,當(dāng)前頁(yè)內(nèi)容簡(jiǎn)介等。
<aside>元素使用注意事項(xiàng):
不要使用<aside>元素標(biāo)記括號(hào)中的文字,因?yàn)檫@種類型的文本被認(rèn)為是主內(nèi)容的一部分。
使用例子:
<article> <p> The Disney movie <em>The Little Mermaid</em> was first released to theatres in 1989. </p> <aside> The movie earned $87 million during its initial release. </aside> <p> More info about the movie... </p> </article>
<article>元素
Article元素(<article>)故名思議,可以表示論壇帖子、雜志或新聞文章、博客、用戶提交的評(píng)論、交互式組件,或者其他獨(dú)立的內(nèi)容項(xiàng)目。它的主要語(yǔ)義為表示自己是一個(gè)獨(dú)立的內(nèi)容結(jié)構(gòu)。每一個(gè)<article>元素內(nèi)部結(jié)構(gòu)都應(yīng)該是相似的,比如都應(yīng)該包含一個(gè)頭標(biāo)題(h1-h6元素)等。
<article>元素用法:
當(dāng)<article>元素嵌套使用時(shí),則該元素代表與父元素有關(guān)的文章。例如,代表博客評(píng)論的<article>元素可嵌套在代表博客文章的<article>元素中。
<article>元素中文章作者的信息可通過(guò)<address>元素表示,但是不適用于嵌套的<article>元素。
<article>元素中文章的發(fā)布日期和時(shí)間可通過(guò)<time>元素的pubdate屬性表示。
代碼樣例
<article class="film_review"> <header> <h2>侏羅紀(jì)公園</h2> </header> <section class="main_review"> <p>Dinos were great!</p> </section> <section class="user_reviews"> <article class="user_review"> <p>Way too scary for me.</p> <footer> <p> Posted on <time datetime="2015-05-16 19:00">May 16</time> by Lisa. </p> </footer> </article> <article class="user_review"> <p>I agree, dinos are my favorite.</p> <footer> <p> Posted on <time datetime="2015-05-17 19:00">May 17</time> by Tom. </p> </footer> </article> </section> <footer> <p> Posted on <time datetime="2015-05-15 19:00">May 15</time> by Staff. </p> </footer> </article>