问题描述
在HTML5中,将blockquotes
放在段落中是否正确,或者相反的正确方法呢?我的意思是,逻辑告诉我们blockquote
可能引用了多个paragraps,不是吗?
In HTML5, is it correct to put blockquotes
inside paragraphs or is the opposite the right way? I mean, logic tells that a blockquote
may be citing multiple paragraps, doesn't it?
但是blockquotes
不需要包含q
元素吗?有人可以向我解释正确的结构吗?
But doesn't blockquotes
need to contain q
elements? Could someone explain me the right structure?
添加一些信息.我有这个疑问,因为当尝试使用CSS实现引号时,它们不会出现在blockquote
上,但是会出现在q
元素上.正确的方法是什么?
To add some info. I got this doubt because when trying to implement quotation marks with CSS, they don't appear on blockquote
but they do on q
elements. What is the right way to do this?
blockquote, q {
quotes: "\201C""\201D""\2018""\2019";
font-style: italic;
}
<blockquote>
<p>Hello!</p>
<p>Say something!</p>
</blockquote>
<p>He told me <q>Say something!</q>
</p>
推荐答案
根据 W3组提供的规范 blockquote
是块级语义,应包含完整的引号,该引号可以由多个段落组成.因为blockquote
本身包含一个或多个段落(或其他元素),所以将其放在段落内没有多大意义. W3G提供的一个示例:
According to the specifications provided by the W3 group the blockquote
is a block level semantic that should contain the entire quote, which can be made up of multiple paragraphs. Because the blockquote
itself contains one or more paragraphs(or other elements), it doesn't make much sense to put it inside a paragraph. An example, provided by the W3G:
<blockquote>
<p>My favorite book is <cite class="from-source">At Swim-Two-Birds</cite></p>
<footer>- <cite>Mike[tm]Smith</cite></footer>
</blockquote>
如您所见,示例blockquote
包含p
元素内部的文本,但不包含在q
元素内部的文本.
As you can see, the example blockquote
contains text that's inside of p
elements, but not inside of q
elements.
q
元素是文本级别的语义,它应用于表示文本的一部分是引号.因为blockquote
已经指示了引号,所以不需要使用q
-元素标记内部的文本.以W3G规范为例:
The q
element is a text level semantic and it should be used to indicate that part of the text is a quotation. Because the blockquote
already indicates quotation, marking the text inside with q
-elements is not necessary. An example, taken from the W3G specification:
<p>The man said <q>Things that are impossible just take longer</q>. I disagreed with him.</p>
长话短说:如果使用blockquote
元素,则在其中放置其他元素(例如p
元素),但是不必在blockquote
中使用q
元素.
Long story short: if you use a blockquote
element, put other elements (such as p
elements) inside of it, but it's not necessary to use q
elements inside a blockquote
.
这篇关于块引用必须包含段落还是段落必须包含块引用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!