HTML <q> Tag

Beginner
6 min read
Updated: Nov 2026
4 examples
Live preview

Definition and Usage

The <q> element marks a short inline quotation inside a sentence or paragraph. Most browsers surround the text with quotation marks automatically.

Optional cite holds a URL for the source document. For longer, stand-alone quotations, use <blockquote>. To name a book, song, or other work, use <cite> (the element — different from the cite attribute).

Baseline · Widely available.

Not deprecated. Stable across browsers since about July 2015 (and much earlier in practice).

Do not type your own quote marks inside <q>.

The browser inserts them. Adding " or ‘ yourself often doubles the marks on screen.

Note.

The cite URL is not shown as a clickable link by default. Put a visible credit in the surrounding text when readers need it.

HTML Syntax

syntax.html
<q> quote text</q>

Both start and end tags are required. Content is phrasing content. Nest another <q> for a quote inside a quote.

Attributes

Element-specific attributes on <q> (plus global attributes):

AttributeDescriptionTry it
citeURL of the source document or message for the quotation (metadata; not a visible link by default)Try it

Global Attributes

The <q> tag also supports the Global Attributes in HTML.

Live Preview

Pick a short quote and see it marked with a real <q> (browser quote marks included).

Do not put extra " characters inside <q> — the browser adds them.

Sentence

Someone once said, Imagination is more important than knowledge.

<q>…</q>

HTML Examples

Short, copy-ready snippets. Use Try It Yourself for a live editor.

Example 1 — Inline Quotation

Mark a short quote inside a sentence. Leave quote characters out of the markup.

HTML
<p>
  Albert Einstein once said,
  <q>Imagination is more important than knowledge.</q>
</p>
Try It Yourself

How It Works

  1. Write the sentence that introduces the quote.
  2. Wrap only the quoted words in <q>.
  3. Do not type " inside the element.
  4. The browser adds opening and closing quotation marks.

Example 2 — cite Attribute

Point to a source URL for tools and metadata (not shown as a link by default).

HTML
<p>
  According to Mozilla’s website,
  <q cite="https://www.mozilla.org/en-US/about/history/details/">
    Firefox 1.0 was released in 2004 and became a big success.
  </q>
</p>
Try It Yourself

How It Works

  1. Add cite="…" with a full URL to the source.
  2. Keep the quote text between the tags without manual marks.
  3. Readers see the quote; the URL stays in the HTML for tools.
  4. Mention the source in prose (here, “Mozilla’s website”) when people need a visible credit.

Example 3 — Nested Quotations

Put a <q> inside another <q> for a quote within a quote.

HTML
<p>
  She wrote,
  <q>He told me <q>Meet me at noon</q> and then left.</q>
</p>
Try It Yourself

How It Works

  1. Outer <q> is the main quotation.
  2. Inner <q> is the quote spoken inside it.
  3. Browsers pick quote styles by nesting level (often double then single).
  4. Control the characters with CSS quotes and document lang when needed.

Example 4 — q vs blockquote

Use q inline; use blockquote for a longer, stand-alone passage.

HTML
<p>
  Short: <q>Stay hungry. Stay foolish.</q>
</p>

<blockquote>
  <p>Your time is limited, so don’t waste it living someone else’s life.</p>
</blockquote>
Try It Yourself

How It Works

  1. <q> stays in the sentence as phrasing content.
  2. <blockquote> is a block that can hold paragraphs.
  3. Both may use the cite attribute for a source URL.
  4. Pick by length and layout, not by which looks fancier.

Edge Cases & Pitfalls

Most q mistakes are double quote marks, wrong companions, or treating cite as a visible link.

marks

Avoid manual quotation characters

Typing "…" inside <q> usually shows four marks. Let the UA insert quotes via ::before / ::after.

length

Long passages belong in blockquote

<q> is for short inline phrases. Multi-paragraph excerpts → <blockquote>.

cite

cite attribute vs <cite> element

Attribute = source URL. Element = title of a work. Do not mix them up when writing credits.

lang

Quote glyphs follow language

Set lang correctly; customize with CSS quotes for French guillemets, German low-high marks, and similar.

Browser Support

The <q> element is core HTML phrasing content in every browser. It is not a Node.js, Deno, or Bun API.

✓ Baseline · Widely available

<q>

Widely available since about July 2015 (and long before). Browsers insert quotation marks around the element; exact glyphs can vary by language and stylesheet.

98% Global support (approx.)
Google Chrome All
Full support
Mozilla Firefox All
Full support
Apple Safari All
Full support
Microsoft Edge All
Full support
Opera All
Full support
Samsung Internet All
Full support
Internet Explorer All
Supported
<q> Widely supported

Bottom line: Safe to use for inline quotes. Skip manual quote characters, use blockquote for long excerpts, and keep visible credits in the surrounding text.

Key Takeaways

  • Role: <q> marks a short inline quotation; browsers add the marks.
  • cite: optional source URL — not a visible link by default.
  • Nesting: wrap quotes in quotes with nested <q> elements.
  • Siblings: long text → blockquote; work titles → <cite>.

One line: wrap the short quote in <q> without typing marks; use blockquote when it needs its own block.

Default CSS Settings

Typical user-agent styling for q (quote glyphs can vary by language):

default.css
q {
  quotes: "\201C" "\201D" "\2018" "\2019";
}
q::before {
  content: open-quote;
}
q::after {
  content: close-quote;
}

Override with CSS quotes, or set quotes: none if you must supply characters yourself (usually avoid that).

Frequently Asked Questions

The q element marks a short inline quotation inside a sentence. Browsers usually add quotation marks around it automatically.
Use blockquote for longer quotations that stand as their own block (often with paragraph breaks). Use q for a short phrase inside running text.
No. Leave the text plain. The browser inserts open and close quotes. Typing your own marks often creates double quotes.
cite on q is a URL pointing to the source of the quote. It is metadata for machines and tools — browsers do not show it as a visible link by default.
The cite attribute is a source URL on q or blockquote. The cite element marks the title of a creative work (book, song, article).
No. It is Baseline and widely available. Prefer it over plain quotation characters when you want semantic inline quotes.

Next: rb

Learn the obsolete HTML rb element used with ruby annotations.

rb tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

12 people found this page helpful