詳解HTML5中的


<aside>元素
HTML<aside>元素表示一個頁面的一部分, 它的內容跟這個頁面的其它內容的關聯性不強,或者是沒有關聯,單獨存在。<aside>元素通常顯示成側邊欄(sidebar)或一些插入補充內容。通常用來在側邊欄顯示一些定義,比如目錄、索引、術語表等;也可以用來顯示相關的廣告宣傳,作者的介紹,Web應用,相關鏈接,當前頁內容簡介等。

<aside>元素使用注意事項:

    不要使用<aside>元素標記括號中的文字,因為這種類型的文本被認為是主內容的一部分。

使用例子:

XML/HTML Code復制內容到剪貼板
  1. <article>  
  2.   <p>  
  3.     The Disney movie <em>The Little Mermaid</em> was   
  4.     first released to theatres in 1989.   
  5.   </p>  
  6.   <aside>  
  7.     The movie earned $87 million during its initial release.   
  8.   </aside>  
  9.   <p>  
  10.     More info about the movie...   
  11.   </p>  
  12. </article>  


<article>元素
Article元素(<article>)故名思議,可以表示論壇帖子、雜志或新聞文章、博客、用戶提交的評論、交互式組件,或者其他獨立的內容項目。它的主要語義為表示自己是一個獨立的內容結構。每一個<article>元素內部結構都應該是相似的,比如都應該包含一個頭標題(h1-h6元素)等。

<article>元素用法:

    當<article>元素嵌套使用時,則該元素代表與父元素有關的文章。例如,代表博客評論的<article>元素可嵌套在代表博客文章的<article>元素中。
    <article>元素中文章作者的信息可通過<address>元素表示,但是不適用於嵌套的<article>元素。

    <article>元素中文章的發布日期和時間可通過<time>元素的pubdate屬性表示。

代碼樣例

XML/HTML Code復制內容到剪貼板
  1. <article class="film_review">  
  2.   <header>  
  3.     <h2>侏羅紀公園</h2>  
  4.   </header>  
  5.   <section class="main_review">  
  6.     <p>Dinos were great!</p>  
  7.   </section>  
  8.   <section class="user_reviews">  
  9.     <article class="user_review">  
  10.       <p>Way too scary for me.</p>  
  11.       <footer>  
  12.         <p>  
  13.           Posted on <time datetime="2015-05-16 19:00">May 16</time> by Lisa.   
  14.         </p>  
  15.       </footer>  
  16.     </article>  
  17.     <article class="user_review">  
  18.       <p>I agree, dinos are my favorite.</p>  
  19.       <footer>  
  20.         <p>  
  21.           Posted on <time datetime="2015-05-17 19:00">May 17</time> by Tom.   
  22.         </p>  
  23.       </footer>  
  24.     </article>  
  25.   </section>  
  26.   <footer>  
  27.     <p>  
  28.       Posted on <time datetime="2015-05-15 19:00">May 15</time> by Staff.   
  29.     </p>  
  30.   </footer>  
  31. </article>  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM