麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 開發 > HTML5 > 正文

HTML5的結構和語義(3):語義性的塊級元素

2024-09-05 07:11:26
字體:
來源:轉載
供稿:網友
  html 5 還增加了一些純語義性的塊級元素: 

  aside  figure   dialog 

  我在文章和書中一直使用前兩個元素。第三個元素我不經常用,它主要用于書面文本。 

aside

  aside 元素代表說明、提示、邊欄、引用、附加注釋等,也就是敘述主線之外的內容。例如,在 developerworks 文章中,常常會看到用表格形式編寫的邊欄,見代碼3 用 html 4 編寫的 developerworks 邊欄。 

<table align="right" border="0" cellpadding="0" cellspacing="0" width="40%">
<tbody><tr><td width="10">
<img alt="" src="//www.ibm.com/i/c.gif" height="1" width="10"></td>
<td>
<table border="1" cellpadding="5" cellspacing="0" width="100%">
<tbody><tr><td bgcolor="#eeeeee">
<p><a name="xf-value"><span class="smalltitle">.xf-value</span></a></p>
<p>
the <code type="inline">.xf-value</code> selector used here styles the input
field value but not its label. this is actually inconsistent
with the current css3 draft. the example really should use the
<code type="inline">::value</code> pseudo-class instead like so:
</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody><tr><td class="code-outline">
<pre class="displaycode">input::value { width: 20em; }
#ccnumber::value { width: 18em }
#zip::value { width: 12em }
#state::value { width: 3em  }</pre>
</td></tr></tbody></table><br>

<p>
however, firefox doesn't yet support this syntax. 
</p>
</td></tr></table>

  在 html 5 中,可以按照更有意義的方式編寫這個邊欄,見代碼4 用 html 5 編寫的 developerworks 邊欄。

<aside>
<h3>.xf-value</h3>
<p>
the <code type="inline">.xf-value</code> selector used here styles the input
field value but not its label. this is actually inconsistent
with the current css3 draft. the example really should use the
<code type="inline">::value</code> pseudo-class instead like so:
</p>
  
<pre class="displaycode">input::value { width: 20em; }
#ccnumber::value { width: 18em }
#zip::value { width: 12em }
#state::value { width: 3em  }</pre>

<p>
however, firefox doesn't yet support this syntax. 
</p>
</aside>

  瀏覽器可以決定把這個邊欄放在哪里(可能需要用一點兒 css 代碼)。 

figure

  figure 元素代表一個塊級圖像,還可以包含說明。例如,在許多 developerworks 文章中,可以看到代碼5 用 html 4 編寫的 developerworks 圖 這樣的標記其結果見圖1。 

<a name="fig2"><b>figure 2. install mozilla xforms dialog</b></a><br />
<img alt="a web site is requesting permission to install the following item: 
   mozilla xforms 0.7 unsigned" 
  src="installdialog.jpg" border="0" height="317" hspace="5" vspace="5" width="331" />
<br />

圖 1. install mozilla xforms dialog 

  在 html 5 中,可以按照更有語義性的方式編寫這個圖,見代碼6 用 html 5 編寫的 developerworks 圖。

<figure id="fig2">
  <legend>figure 2. install mozilla xforms dialog</legend>
  <img alt="a web site is requesting permission to install the following item: 
    mozilla xforms 0.7 unsigned" 
    src="installdialog.jpg" border="0" height="317" hspace="5" vspace="5" width="331" />
</figure>

  最重要的是,瀏覽器(尤其是屏幕閱讀器)可以明確地將圖和說明聯系在一起。 
  figure 元素不只可以顯示圖片。還可以使用它給 audio、video、iframe、object 和 embed 元素加說明。 

dialog

  dialog 元素表示幾個人之間的對話。html 5 dt 元素可以表示講話者,html 5 dd 元素可以表示講話內容。所以,在老式瀏覽器中也可以以合理的方式顯示對話。代碼7 顯示在 galileo 的 “dialogue concerning the two chief world systems” 上的一段著名對話。 

  代碼7. 用 html 5 編寫的 galilean 對話

<dialog>
    <dt>simplicius </dt> 
    <dd>according to the straight line af,
    and not according to the curve, such being already excluded
    for such a use.</dd>

    <dt>sagredo </dt> 
    <dd>but i should take neither of them,
    seeing that the straight line af runs obliquely. i should
    draw a line perpendicular to cd, for this would seem to me
    to be the shortest, as well as being unique among the
    infinite number of longer and unequal ones which may be
    drawn from the point a to every other point of the opposite
    line cd. </dd>

    <dt>salviati </dt> 
    <dd><p> your choice and the reason you
    adduce for it seem to me most excellent. so now we have it
    that the first dimension is determined by a straight line;
    the second (namely, breadth) by another straight line, and
    not only straight, but at right angles to that which
    determines the length. thus we have defined the two
    dimensions of a surface; that is, length and breadth. </p>

    <p> but suppose you had to determine a height—for
    example, how high this platform is from the pavement down
    below there. seeing that from any point in the platform we
    may draw infinite lines, curved or straight, and all of
    different lengths, to the infinite points of the pavement
    below, which of all these lines would you make use of? </p>
    </dd>
</dialog>

  對于這個元素的準確語法還有爭議。一些人希望在 dialog 元素中嵌入非對話文本(比如劇本中的舞臺說明),還有人不喜歡擴展 dt 和 dd 元素的作用。盡管在具體語法方面有爭議,但是大多數人都認為以這樣的語義性方式表達對話是好事情。 
  
  (待續)
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 91成人影库 | 日本黄色一级电影 | 成人在线观看一区 | 国产青草视频在线观看 | 91九色论坛| 欧美一级做性受免费大片免费 | 99热1| 中文在线观看www | 一区二区三区在线视频观看58 | 精品亚洲午夜久久久久91 | 亚洲小视频在线观看,com | 一区二区三区欧美在线观看 | 国产精品久久久久久婷婷天堂 | 国产91成人| 欧美亚洲一区二区三区四区 | 欧美一级特黄aaaaaaa什 | 色网在线视频 | 久久毛片免费 | 欧美一区中文字幕 | 精品国产91久久久久久久 | 久久久久久久久国产精品 | 羞羞视频免费观看网站 | 黄网站免费在线看 | 成人小视频免费在线观看 | 看91| 色成人在线 | 亚洲伊人色欲综合网 | 色婷婷久久久亚洲一区二区三区 | 成人精品久久 | 欧美视频一区二区三区 | 中国的免费的视频 | 在线成人免费视频 | 成人福利在线观看 | www.17c亚洲蜜桃 | 一本色道久久99精品综合蜜臀 | 国产精品毛片无码 | 99久久婷婷国产综合精品青牛牛 | 色诱亚洲精品久久久久久 | 久久色播| 久久视频精品 | 羞羞视频免费视频欧美 |