关于语义化,不是一句两句就能说明白的,而且现在也没有一个官方的很严格的定义。关于<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>“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.”</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型文档更严格,也算是向后兼容了。
新闻热点
疑难解答