Correct use of Blockquote, q and cite?

0 votes
asked Feb 5, 2010 by jitendra-vyas

Is this the correct use of Blockquote, q and cite?

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

Is use of Blockquote, q semantically correct? or both are presentational element , so should not be used?

7 Answers

0 votes
answered Feb 5, 2010 by jansen-price
0 votes
answered Feb 5, 2010 by traveling-tech-guy

According to this, "cite" is an attribute of q - and is not well supported at that.

0 votes
answered Feb 5, 2010 by joel

You could consider BLOCKQUOTE analogous to a DIV and Q analogous to SPAN.

Recommended usage is to enclose large quotes in BLOCKQUOTE and small, single line or sentence quotes in Q.

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

Cite is an attribute on either which merely points to the source.

0 votes
answered Feb 5, 2010 by josh-lee

Yes. They are not presentational elements — blockquote represents a block quotation, q represents an inline quotation, and cite represents a reference to a name, work, standard, URL, etc.

You do have some validation errors that are fairly common with blockquote. A blockquote element cannot be inside a paragraph, and in HTML4 actually needs to contain paragraphs. The nesting of the p and blockquote elements in your fragment needs to be reversed.

The blockquote element (also the q element) can optionally have a cite attribute to specify a URI where the quote came from. HTML5 says user agents should make that link available to the user, and HTML4 doesn't say anything at all. I would include the URI both in the cite attribute and as an inline link, since browsers don't handle it.

Here's how I would write that fragment, with those revisions in mind:

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

Validate this fragment

0 votes
answered Feb 19, 2013 by yumyo

The semantic (and valid) use of the <cite> element is still under debate even if "in HTML5, use of this element to mark a person's name is no longer considered semantically appropriate."

You'll find a very detailed and useful article about "<blockquote>, <q> and <cite>" here:

0 votes
answered Feb 22, 2014 by javarome

Using attributes such as the cite attribute of the blockquote or q doesn't make it easily displayable (without JS or tricky CSS) and so does not address the aim of displaying a reference link easily. It is now conforming to include cite (and/or footer) into blockquote to specify the source, either textually of through a URL, of the quote, like below :

  <p>Beware of bugs in the above code; I have only proved it correct, not tried it.” </p>
  <cite><a href="">Donald Knuth: Notes on the van Emde Boas construction of priority deques: An instructive use of recursion, March 29th, 1977</a>

Note that :

  • cases of cite that are part of the quote contents (not the source reference) are also deemed quite rare, and should be handle through a differenciating class on the relevant cite subtag)

  • Regarding q, it is indeed aimed to quote inline, but it is more likely to be used outside of blockquotes (quotes into quotes are quite rare).

0 votes
answered Feb 25, 2015 by chuck-le-butt

The other answers on this page are out of date, but the question is still valid.

The q element is an inline element and should be used like so (ie. no block elements inside it):

   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>

Another example:

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

The q element should not be placed inside a blockquote element, as it would be redundant -- both denote a quote.

A blockquote is a block element, allowing other block elements to be placed inside:

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

<cite> is slightly more complicated. It's an inline element but it depends which HTML spec you're following. The W3C states that it may contain a URL, a title of a work (eg. book title, film title, etc.), or an author's name.

The WHATWG states that it may only contain a URL or a title of a work, and so not a person's name.

This is a valid WHATWG usage:

  <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>
 <figcaption>Carl Sagan, in "<cite>Wonder and Skepticism</cite>", from
 the <cite>Skeptical Inquirer</cite> Volume 19, Issue 1 (January-February
Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter