59

这是Blockquote, q和的正确用法cite吗?

<p>
<blockquote>Type HTML in the textarea above, <q>and it will magically appear</q> in the frame below.
</blockquote>
<cite><a href="http://stackoverflow.com">refrence url</a>
</p>

使用Blockquote, q语义正确吗?或者两者都是表现元素,所以不应该使用?

4

6 回答 6

57

是的。它们不是表现元素——blockquote代表块引用,q代表内联引用,cite代表对名称、作品、标准、URL等的引用。

您确实有一些在 blockquote 中相当常见的验证错误。块引用元素不能在段落内,而在 HTML4 中实际上需要包含段落。p需要反转片段中和blockquote元素的嵌套。

blockquote元素(也是q元素)可以选择有一个cite属性来指定引用来源的 URI 。HTML5 说用户代理应该使该链接对用户可用,而 HTML4 根本没有说什么。我会在cite属性和内联链接中包含 URI,因为浏览器不处理它。

以下是我将如何编写该片段,并考虑到这些修订:

<blockquote cite="http://stackoverflow.com">
  <p>Type HTML in the textarea above, <q>and it will magically
  appear</q> in the frame below.</p>
</blockquote>
<p>
  <cite><a href="http://stackoverflow.com">reference url</a></cite>
</p>

验证这个片段

于 2010-02-05T05:22:21.973 回答
16

此页面上的其他答案已过时,但问题仍然有效。

q元素在语义上表示一个引用,并且是一个内联元素。它应该像这样使用(即其中没有块元素):

<p>
   In the words of <cite>Charles Bukowski</cite> -  
   <q>An intellectual says a simple thing in a hard way. 
   An artist says a hard thing in a simple way.</q>
</p>

另一个例子:

<p>
    <q>This is correct, said Hillary.</q> is a quote from the 
    popular daytime TV drama <cite>When Ian became Hillary</cite>.
</p> 

q元素不应放在元素内blockquote,因为它是多余的——两者都表示引号。

Ablockquote是一个块元素,允许在里面放置其他块元素:

  <blockquote>
    <p>My favorite book is <cite>At Swim-Two-Birds</cite>.</p>
    - <cite>Mike Smith</cite>
  </blockquote>

<cite>是一个内联元素,表示作品的标题。由于 W3C 和 WHATWG 现在已经同意合作,我们对它可能包含的内容有一个答案:书名、电影名、电视节目名、游戏名、歌曲名、戏剧名等,等等。

它不应该是 URL 或作者的名字。

这是一个有效的用法:

<figure>
 <blockquote>
  <p>The truth may be puzzling. It may take some work to grapple with.
  It may be counterintuitive. It may contradict deeply held
  prejudices. It may not be consonant with what we desperately want to
  be true. But our preferences do not determine what's true.</p>
 </blockquote>
 <figcaption>Carl Sagan, in "<cite>Wonder and Skepticism</cite>", from
 the <cite>Skeptical Inquirer</cite> Volume 19, Issue 1 (January-February
 1995)</figcaption>
</figure>
于 2015-09-25T09:17:49.323 回答
5

您可以考虑BLOCKQUOTE类似于 aDIVQ类似于SPAN.

推荐的用法是将大引号BLOCKQUOTE括在Q.

<blockquote>
    <p>This is a big quote.</p>
    <p>This is the second paragraph with a smaller <q>quote</q> inside</p>
</blockquote>

引用是任何一个的属性,它仅指向来源。

于 2010-02-05T05:12:40.847 回答
3

使用诸如or的cite属性之类的属性不会使其易于显示(没有 JS 或棘手的 CSS),因此无法解决轻松显示参考链接的目的。它现在符合include (and/or ) into来指定引用的来源,无论是文本还是通过 URL,如下所示:blockquoteqcitefooter blockquote

<blockquote>
  <p>Beware of bugs in the above code; I have only proved it correct, not tried it.” </p>
  <cite><a href="http://www-cs-faculty.stanford.edu/~uno/faq.html">Donald Knuth: Notes on the van Emde Boas construction of priority deques: An instructive use of recursion, March 29th, 1977</a>
</blockquote>

注意 :

  • 作为引用内容(不是源引用)的一部分的情况cite也被认为是非常罕见的,应该通过相关cite子标签上的差异化类来处理)

  • 关于q,它确实旨在引用内联,但它更有可能在块引用之外使用(引号中的引用非常罕见)。

于 2014-03-22T20:10:09.607 回答
0

即使“在 HTML5 中,使用此元素来标记人名不再被认为在语义上合适”,该元素的语义(和有效)使用<cite>仍在争论中。

您可以在此处找到有关 " 和 " 的非常详细且有用<blockquote><q>文章<cite>

http://html5doctor.com/blockquote-q-cite/

于 2013-09-19T14:25:31.383 回答
0

据此 “引用”是 q 的一个属性- 并没有得到很好的支持。

于 2010-02-05T05:06:13.743 回答