HTML <q> Element

The HTML <q> element represents a short inline quotation that appears within a sentence or other surrounding text.

Syntax

<p>The instructor said, <q>Practice writing HTML every day.</q></p>

The <q> element requires both an opening and closing tag. Browsers normally add quotation marks around the enclosed text automatically.

Attributes

The <q> element supports the global HTML attributes and the following element-specific attribute:

Attribute Description
cite Specifies a URL that identifies the source of the quotation.

Example

This example uses the <q> element to identify a short quotation within a paragraph.

Play in Editor

Usage Notes

Use the <q> element for short quotations that are part of a paragraph or sentence. For longer quotations that should appear as a separate block of content, use the <blockquote> element instead.

Browsers normally insert the appropriate quotation marks around <q> content, so quotation mark characters generally should not be typed directly inside the element.

The optional cite attribute can provide the URL of the source document or message from which the quotation was taken. The URL is metadata and is not normally displayed to users by the browser.

If readers should be able to visit the source, provide a visible <a> link in addition to the cite attribute.

Accessibility

Using the <q> element gives a short quotation semantic meaning instead of relying only on manually typed quotation marks.

Make sure the surrounding text clearly identifies the speaker or source when that information is important for understanding the quotation. Do not rely on the cite attribute alone to provide source information that users need to see.

Browser Support

Baseline: Widely available indicates a feature has been supported by core browsers for at least 30 months. At this stage, the feature is considered stable and safe for most websites to use without needing to worry about compatibility issues or fallbacks, as it is supported by the vast majority of users' devices and browser versions.

For detailed browser compatibility information, see Can I Use: HTML <q> Element .

The <q> element is closely related to the <blockquote> element for longer quotations and the <cite> element for identifying the title of a cited creative work.

Specifications

HTML Living Standard: The <q> Element