Codectionary / Developer documentation / HTML

<blockquote>, <q>

HTML provides two elements for quoting content from another source. <blockquote> is used for longer, block-level quotations that are typically set apart from surrounding text with indentation. <q> is used for shorter, inline quotations within a sentence, and browsers automatically render it with quotation marks. Both support a cite attribute pointing to the source URL.

Syntax

<blockquote cite="https://source.com">Quoted text</blockquote>
<p>She said <q>hello</q>.</p>

Examples

Block Quotation

A longer quotation set apart from the main text.

<blockquote cite="https://example.com/article">
  <p>The best way to predict the future is to invent it.</p>
</blockquote>

Inline Quotation

A short quote embedded within a sentence.

<p>As the saying goes, <q>a journey of a thousand miles begins with a single step</q>.</p>

Quotation with Attribution

Adding a citation for a blockquote using the footer/cite pattern.

<blockquote>
  <p>Simplicity is the ultimate sophistication.</p>
  <footer>— <cite>Leonardo da Vinci</cite></footer>
</blockquote>

Attributes

  • cite (URL): A URL pointing to the source of the quotation

Best practices

  • Use <blockquote> for multi-line or block-level quotes, and <q> for short quotes within a sentence
  • Do not add manual quotation marks inside <q> — browsers add them automatically via CSS
  • Use the cite attribute to link back to the original source when available
  • Pair a <blockquote> with a <footer><cite>...</cite></footer> to properly attribute the author

At a glance

Purpose
Structure and meaning for web content
File extension
.html · .htm
Runs in
Web browsers
Usually used with
CSS and JavaScript

Specifications & further reading

Related HTML documentation

<span>
The <span> element is an inline container used to group and style specific portions of text or inline elements. Unlike <div>, which is block-level, <span> doesn't break the flow of content. It's perfect for applying styles or manipulating specific words or phrases within a paragraph without affecting the surrounding content.
<h1> - <h6>
The heading elements <h1> through <h6> represent six levels of section headings, with <h1> being the most important and <h6> the least. Headings create a document outline that both sighted users and assistive technologies rely on to understand and navigate page structure. Search engines also use heading hierarchy to interpret content relevance. Each page should typically have exactly one <h1> describing its main topic, with subsequent headings nested logically to reflect the content hierarchy.
<p>
The <p> element represents a paragraph of text — one of the most fundamental building blocks of written content on the web. Browsers automatically add margin above and below paragraphs to visually separate them. The <p> element cannot contain other block-level elements like <div> or headings, only inline content and text. It is a block-level element, meaning it always starts on a new line.
Text Formatting: <strong>, <em>, <b>, <i>, <mark>, <small>
HTML provides several inline elements for formatting text with semantic and visual meaning. <strong> indicates strong importance (typically rendered bold), and <em> indicates stress emphasis (typically rendered italic) — both carry semantic weight that screen readers can announce. <b> and <i> are their purely visual counterparts, used when bold/italic styling is needed without implying importance or emphasis. <mark> highlights text as relevant to the current context, and <small> represents side comments like fine print or disclaimers.