国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > HTML > 正文

blockquote標記應用注意

2024-08-26 00:08:54
字體:
來源:轉載
供稿:網友

關于語義化,不是一句兩句就能說明白的,而且現在也沒有一個官方的很嚴格的定義。關于<blockquote>沒有爭議的是:

1.引用一段較長的文字

2.可以使用cite標簽或者屬性

問題是<blockquote>引用的文字必須使用塊級元素將他包含嗎?

首先是來自w3c的解釋

9.2.2 quotations: the blockquote and q elements<!element blockquote - - (%block;|script)+ -- long quotation --><!attlist blockquote %attrs;
                              -- %coreattrs, %i18n, %events -- cite
       %uri;
          #implied  -- uri for source document or msg -- ><!element q - - (%inline;)*
           -- short inline quotation --><!attlist q %attrs;
                             -- %coreattrs, %i18n, %events -- cite
        %uri;
          #implied  -- uri for source document or msg -- >

這兩個便簽指名包含的內容為引用文字. blockquote 用于長文字的引用(block-level content) 而 q 用于短文字的引用(inline content) 且不允許引用的句子不完整。

這個例子的文字來自 "the two towers", 作者 j.r.r. tolkien, 最為引用文字.

<blockquote cite="http://www.mycom.com/tolkien/twotowers.html"><p>they went in single file, running like hounds on a strong scent,and an eager light was in their eyes. nearly due west the broad swath of the marching orcs tramped its ugly slot; the sweet grass of rohan had been bruised and blackened as they passed.</p></blockquote>

這篇文章是應用web標準進行開發,里面提到了關于一些tags的語義下面摘錄的是<blockquote>

for longer quotations that form one or more paragraphs, the <blockquote> element should be used. css can then be used to style the quotation. note that text is not allowed directly inside a <blockquote> element – it must be contained in an element, usually a <p> element.
example:<blockquote cite="http://www.w3.org/tr/1999/rec-html401-19991224/struct/text.html"> <p>&#8220;the following sections discuss issues surrounding the structuring of text. elements that present text (alignment elements, font elements, style sheets, etc.) are discussed elsewhere in the specification. for information about characters, please consult the section on the document character set.&#8221;</p></blockquote>
http://24ways.org/advent/transitional-vs-strict-markup

這篇文章是關于transitional-vs-strict,過渡型和標準型xhtml的區別,里面提到了內容模型的區別,有關于<blockquote>的內容,在strict中,引用的內容必須使用塊級元素將其包含,通常是<p>,<div>中。

content model differences

an element type’s content model describes what may be contained by an instance of the element type. the most important difference in content models between transitional and strict is that blockquote, body, and form elements may only contain block level elements. a few examples:

text and images are not allowed immediately inside the body element, and need to be contained in a block level element like p or div
input elements must not be direct descendants of a form element
text in blockquote elements must be wrapped in a block level element like p or div

所以,我認為,在strict型必須用塊級元素將引用文字包含,而在非strict型中就不必了,但是建議這樣這樣做,因為strict型文檔更嚴格,也算是向后兼容了。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 司法| 交城县| 凤凰县| 房产| 淳化县| 交口县| 当雄县| 民勤县| 德昌县| 平泉县| 樟树市| 建始县| 什邡市| 万山特区| 鹿邑县| 象州县| 东安县| 翁源县| 东台市| 卢龙县| 鹤岗市| 墨玉县| 汝南县| 三原县| 绥棱县| 太仓市| 驻马店市| 曲周县| 克什克腾旗| 新干县| 德惠市| 岑溪市| 晴隆县| 古蔺县| 永顺县| 清徐县| 镇远县| 平原县| 新乐市| 迭部县| 宜丰县|