q Element


 

Module

The q element is an inline element declared by the XHTML 1.1 Text Module (Inline Phrasal)

Elements in the Text Module are:
span | br (Inline Structural Support Module)
em | strong | q | cite | abbr | acronym | code | var | kbd | samp | dfn (Inline Phrasal Support Module)
div | p (Block Structural Support Module)
h1 - h6 | blockquote | pre | address (Block Phrasal Support Module)

Description

The q element is used to mark up a brief, inline quotation and can be used with or without its optional cite attribute (not to be confused with the cite element). The contents of the q element are often, but not always, placed in quotation marks by the browser. If a longer quotation is desired, requiring more than one paragraph, the blockquote element should be used.

Firstly, the use of q in combination with a cite element is shown in the following example:

<p>As Charmian says in <cite>Shakespeare's Antony &amp; Cleopatra</cite>: <q>I love long life better than figs.</q></p>

which renders as follows:

As Charmian says in Shakespeare's Antony & Cleopatra: I love long life better than figs.

The q element above is not styled and so is displayed using your browser's default behaviour. This means that if the quoted text is surrounded by quotation marks (which may vary in appearance according to language or locale) then your browser automatically adds them and if not then it doesn't. This behaviour is not very standard and should not be relied upon - for this reason, some avoid the use of the q element.

The cite attribute may be used to specify a URI from which the quotation has been taken. However, currently there are no browsers of which I am aware that recognise the cite attribute and present the user with an actual link to the URI. Unless something is done by the author (for example including JavaScript to find the cite attributes and explicitly create links to the URIs) there is no easy way for someone viewing the page to even know the citation is there. It is probably best to acknowledge your source using a cite element in combination with a hyperlink (but include the cite attribute as well to explicitly link that quote to that URI - as far as search engines are concerned, for example). The JavaScript method is a solution, of course, but you can never guarantee that viewers of your page will have a compatible version of JavaScript installed and enabled. Your quoted source may also insist on a conventional hyperlink as their citation.

This second example shows the use of the cite attribute to specify a URI for the citation. This is used in combination with a cite element and hyperlink.

<p>It says on
<cite><a href="http://en.wikipedia.org/wiki/Hippopotamus">Wikipedia's
Hippopotamus page</a></cite> that
<q cite="http://en.wikipedia.org/wiki/Hippopotamus">Hippos
spend most of their days wallowing in the water or the mud</q>.
This sounds like a very enjoyable use of time to me!</p>

This example renders as:

It says on Wikipedia's Hippopotamus page that Hippos spend most of their days wallowing in the water or the mud. This sounds like a very enjoyable use of time to me!

#REQUIRED Attributes

There are no #REQUIRED attributes on the q element.


Specific Attributes

Specific attributes of the q element are listed below:

From the Text Module (Inline Phrasal) - the Element's own Module

cite [ type URI ]
The URI from which the quotation has been taken

Common Attributes

Common attributes of the q element are listed below:

From the Core Attribute Collection

class [ type NMTOKENS ]
One or more space separated classes
id [ type ID ]
A unique identifier for the element
style [ type CDATA ], from the Style Attribute Module (deprecated)
Element-specific styles
title [ type Text ]
Descriptive title for the element (in some user agents this may appear as a "tooltip" when the mouse hovers over the element)
xmlns [ type URI - #FIXED 'http://www.w3.org/1999/xhtml' ]
XML namespace

From the I18N Attribute Collection

dir [ type Enumeration (ltr | rtl) ], from the Bi-directional Text Module
Left-to-right or right-to-left directionality
xml:lang [ type LanguageCode ]
A language code for the element

From the Events Attribute Collection

All attributes in the Events Attribute Collection are supported:
onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup


Content Model

The Content Model for the q element is:

( #PCDATA | Inline.mix )*

See Content Model & Nesting for information about Content Model syntax and Nesting Groups.

Valid children of q

Valid parents of q


Page Footer & Copyright

Copyright © Sally Maughan 2005-2009 (Page last updated on 01 Oct 2009)

*Valid XHTML 1.1 - hosted by *Openstrike

Content based on the W3C Working Draft: *XHTML 1.1 and Recommendation: *XHTML Modularisation 1.1.

W3C, XHTML, XML, HTML, CSS and MathML are *Trademarks of the W3C (*MIT, *ERCIM, *Keio) with which the site's author has no connection.


Up, Next & Previous Links

Your Location

Home > XHTML 1.1 Home > XHTML 1.1 Indexes > Element Index (XHTML 1.1) > q Element