Skip to content
Tutorials Center
My learning

Topics

HTML Reference Β· Inline Text

The <q> element

Reference for the HTML <q> element: short inline quotations, automatic quotation marks, the cite attribute, language-aware quotes and technical details.

The <q> element marks a short quotation that sits inside a line of text, such as a few words someone said or wrote. Browsers add the quotation marks for you, so you type only the quoted words. For a quotation that forms its own paragraph or block, use <blockquote> instead.

HTML
<p>The guide's only advice was <q>pack less than you think</q>.</p>

Try it

Inline quotations

A <q> nested inside another <q> gets the secondary style of quotation marks (single quotes in English). The marks also follow the lang of the text, so French and German quotes look different from English ones.

Attributes

Attribute Values Description
cite A valid URL The address of the source document or message the quotation comes from. Browsers do not display it; scripts and tools can read it.

The element also accepts the global attributes.

Usage notes

  • Don't type the quotation marks yourself. The browser inserts them through the CSS quotes property and the ::before and ::after pseudo-elements. Adding your own produces doubled marks.
  • Use it only for real quotations. Sarcastic "scare quotes", titles of works, or words you are talking about are not quotations from a source. Type ordinary quotation marks for those, or use <cite> for a work's title.
  • Short quotes only. If the quotation is a full paragraph or several sentences shown as a block, switch to <blockquote>.
  • cite is invisible. If the reader should see the source, add a visible link or a <cite> element near the quotation.
  • Copying text. The generated quotation marks are not part of the document text, so some browsers leave them out when a user copies the passage.
  • Styling. Change the marks with CSS, for example q { quotes: "Β«" "Β»" "β€Ή" "β€Ί"; }. Setting quotes: none removes them.

Technical summary

Content categories Flow content, phrasing content, palpable content
Permitted content Phrasing content
Tag omission None; both the start and end tags are required
Permitted parents Any element that accepts phrasing content
Implicit ARIA role generic
DOM interface HTMLQuoteElement
Default display inline (with quotation marks added before and after)

Browser support

Supported in every browser, including automatic language-specific quotation marks.