校园春色亚洲色图_亚洲视频分类_中文字幕精品一区二区精品_麻豆一区区三区四区产品精品蜜桃

主頁 > 知識庫 > HTML5的結構和語義(3):語義性的塊級元素

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

熱門標簽:搜狗星級酒店地圖標注 洛陽市伊川縣地圖標注中心官網 會聲會影怎樣做地圖標注效果 高德地圖標注錯誤怎么修改 標準智能外呼系統 地圖標注自己去過的地方 電銷機器人視頻 平頂山電子地圖標注怎么修改 江蘇高頻外呼系統線路
  HTML5還增加了一些純語義性的塊級元素:
  aside  figure  dialog
  我在文章和書中一直使用前兩個元素。第三個元素我不經常用,它主要用于書面文本。
aside
  aside元素代表說明、提示、邊欄、引用、附加注釋等,也就是敘述主線之外的內容。例如,在developerWorks文章中,常常會看到用表格形式編寫的邊欄,見代碼3用HTML4編寫的developerWorks邊欄。
<tablealign="right"border="0"cellpadding="0"cellspacing="0"width="40%">
<tbody><tr><tdwidth="10">
<imgalt=""src="//www.ibm.com/i/c.gif"height="1"width="10"></td>
<td>
<tableborder="1"cellpadding="5"cellspacing="0"width="100%">
<tbody><tr><tdbgcolor="#eeeeee">
<p><aname="xf-value"><spanclass="smalltitle">.xf-value</span></a></p>
<p>
The<codetype="inline">.xf-value</code>selectorusedherestylestheinput
fieldvaluebutnotitslabel.Thisisactuallyinconsistent
withthecurrentCSS3draft.Theexamplereallyshouldusethe
<codetype="inline">::value</code>pseudo-classinsteadlikeso:
</p>
<tableborder="0"cellpadding="0"cellspacing="0"width="100%">
<tbody><tr><tdclass="code-outline">
<preclass="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,Firefoxdoesn'tyetsupportthissyntax.
</p>
</td></tr></table>
  在HTML5中,可以按照更有意義的方式編寫這個邊欄,見代碼4用HTML5編寫的developerWorks邊欄。
<aside>
<h3>.xf-value</h3>
<p>
The<codetype="inline">.xf-value</code>selectorusedherestylestheinput
fieldvaluebutnotitslabel.Thisisactuallyinconsistent
withthecurrentCSS3draft.Theexamplereallyshouldusethe
<codetype="inline">::value</code>pseudo-classinsteadlikeso:
</p>

<preclass="displaycode">input::value{width:20em;}
#ccnumber::value{width:18em}
#zip::value{width:12em}
#state::value{width:3em}</pre>
<p>
However,Firefoxdoesn'tyetsupportthissyntax.
</p>
</aside>

  瀏覽器可以決定把這個邊欄放在哪里(可能需要用一點兒CSS代碼)。
figure
  figure元素代表一個塊級圖像,還可以包含說明。例如,在許多developerWorks文章中,可以看到代碼5用HTML4編寫的developerWorks圖這樣的標記其結果見圖1。
<aname="fig2"><b>Figure2.InstallMozillaXFormsdialog</b></a><br/>
<imgalt="AWebsiteisrequestingpermissiontoinstallthefollowingitem:
MozillaXForms0.7Unsigned"
src="installdialog.jpg"border="0"height="317"hspace="5"vspace="5"width="331"/>
<br/>

圖1.InstallMozillaXFormsdialog

  在HTML5中,可以按照更有語義性的方式編寫這個圖,見代碼6用HTML5編寫的developerWorks圖。
<figureid="fig2">
<legend>Figure2.InstallMozillaXFormsdialog</legend>
<imgalt="AWebsiteisrequestingpermissiontoinstallthefollowingitem:
MozillaXForms0.7Unsigned"
src="installdialog.jpg"border="0"height="317"hspace="5"vspace="5"width="331"/>
</figure>

  最重要的是,瀏覽器(尤其是屏幕閱讀器)可以明確地將圖和說明聯系在一起。
  figure元素不只可以顯示圖片。還可以使用它給audio、video、iframe、object和embed元素加說明。
dialog
  dialog元素表示幾個人之間的對話。HTML5dt元素可以表示講話者,HTML5dd元素可以表示講話內容。所以,在老式瀏覽器中也可以以合理的方式顯示對話。代碼7顯示在Galileo的“DialogueConcerningtheTwoChiefWorldSystems”上的一段著名對話。
  代碼7.用HTML5編寫的Galilean對話
<dialog>
<dt>Simplicius</dt>
<dd>AccordingtothestraightlineAF,
andnotaccordingtothecurve,suchbeingalreadyexcluded
forsuchause.</dd>
<dt>Sagredo</dt>
<dd>ButIshouldtakeneitherofthem,
seeingthatthestraightlineAFrunsobliquely.Ishould
drawalineperpendiculartoCD,forthiswouldseemtome
tobetheshortest,aswellasbeinguniqueamongthe
infinitenumberoflongerandunequaloneswhichmaybe
drawnfromthepointAtoeveryotherpointoftheopposite
lineCD.</dd>
<dt>Salviati</dt>
<dd><p>Yourchoiceandthereasonyou
adduceforitseemtomemostexcellent.Sonowwehaveit
thatthefirstdimensionisdeterminedbyastraightline;
thesecond(namely,breadth)byanotherstraightline,and
notonlystraight,butatrightanglestothatwhich
determinesthelength.Thuswehavedefinedthetwo
dimensionsofasurface;thatis,lengthandbreadth.</p>
<p>Butsupposeyouhadtodetermineaheight—for
example,howhighthisplatformisfromthepavementdown
belowthere.Seeingthatfromanypointintheplatformwe
maydrawinfinitelines,curvedorstraight,andallof
differentlengths,totheinfinitepointsofthepavement
below,whichofalltheselineswouldyoumakeuseof?</p>
</dd>
</dialog>
  對于這個元素的準確語法還有爭議。一些人希望在dialog元素中嵌入非對話文本(比如劇本中的舞臺說明),還有人不喜歡擴展dt和dd元素的作用。盡管在具體語法方面有爭議,但是大多數人都認為以這樣的語義性方式表達對話是好事情。
  
 ?。ùm)

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

巨人網絡通訊聲明:本文標題《HTML5的結構和語義(3):語義性的塊級元素》,本文關鍵詞  HTML5,的,結構,和,語義,性的,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《HTML5的結構和語義(3):語義性的塊級元素》相關的同類信息!
  • 本頁收集關于HTML5的結構和語義(3):語義性的塊級元素的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 广汉市| 咸宁市| 和田县| 平果县| 信丰县| 资溪县| 湘西| 金山区| 瑞金市| 仙桃市| 大宁县| 江都市| 漠河县| 库车县| 沐川县| 咸阳市| 湖南省| 长汀县| 叙永县| 永年县| 定边县| 宁晋县| 齐河县| 丰顺县| 鄂尔多斯市| 晋州市| 临沂市| 子洲县| 奇台县| 泊头市| 刚察县| 黄大仙区| 扎兰屯市| 江源县| 贵德县| 密山市| 霍州市| 奉化市| 久治县| 金秀| 浮梁县|