Most demos need a newer browser

They use :has() and container queries. Update your browser, or on an iPhone update iOS to 16.4 or later.

CSS Blockquote Styles

CSS blockquote styles with quotes and ::before { content: open-quote }, styled attribution outside the quote, and a pull quote that works inside a column.

Level
Beginner
Published
Updated
Reading time
5 min

Try it

4 live demos

Sample quotation text goes here.

Author name, Title of the work

A quote, its marks and its credit

Other ways to build it

This paragraph is sample body text standing in for an article. A pull quote lifts one line out of the text and sets it large, so a reader skimming the page still catches it.

A second paragraph of sample text continues the column. The pull quote floats to the right, and the text flows around its left side and below it.

A third paragraph closes the sample. In a narrow column the pull quote stops floating and sits between paragraphs at full width.

Pull quote in a column of text

See the code

A short quote from a happy customer goes here. Two or three lines is plenty for a card like this one.

Customer nameJob title

Testimonial card

See the code

The outer quotation uses the first pair of marks. When it quotes another source, the inner quotation switches to the second pair, with no extra markup.

Classic left border, with a quote inside a quote

See the code

Build it

8 snippets to copy

CSS Blockquote Styles

HTML

<figure class="bq">
  <blockquote class="bq-quote">
    <p>Sample quotation text goes here.</p>
  </blockquote>
  <figcaption class="bq-credit">
    Author name, <cite>Title of the work</cite>
  </figcaption>
</figure>

CSS

/* the figure holds the quote and its credit,
   so the credit stays outside the quote */
.bq {
  width: 100%;
  max-width: 32rem;
  margin: 0;
}

/* the first pair is for the quote, the second
   for a quote inside it */
.bq-quote {
  position: relative;
  margin: 0;
  padding: 4.25rem 0 3.5rem;
  quotes: "\201C" "\201D" "\2018" "\2019";
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.625rem;
  line-height: 1.35;
  color: #f0f0f0;
}

.bq-quote p {
  margin: 0;
}

.bq-quote::before,
.bq-quote::after {
  position: absolute;
  height: .5em;
  font-size: 10rem;
  line-height: 1;
  color: #b8ff57;
}

.bq-quote::before {
  content: open-quote;
  top: -.06em;
  left: -.04em;
}

.bq-quote::after {
  content: close-quote;
  right: -.04em;
  bottom: -.06em;
}

.bq-credit {
  font-size: .95rem;
  line-height: 1.5;
  color: #88888f;
}

.bq-credit::before {
  content: "";
  display: inline-block;
  width: 2rem;
  height: 2px;
  margin-right: .75rem;
  vertical-align: middle;
  background: #b8ff57;
}

.bq-credit cite {
  font-style: italic;
  color: #f0f0f0;
}

Pull quote in a column of text

A pull quote lifts one line out of the article and sets it large, floated to the right at 45% width so the text flows around it. A @container (width < 30rem) query turns the float off in a narrow column, and aria-hidden="true" hides it from screen readers because the words are already in the article text. The marks are small and inline, generated the same way as the main demo but at text size rather than oversized.

HTML

<article class="bq-article">
  <p>This paragraph is sample body text standing in for an
  article. A pull quote lifts one line out of the text and
  sets it large, so a reader skimming the page still
  catches it.</p>

  <!-- the words are already in the article, so screen
       readers skip the repeat -->
  <aside class="bq-pull" aria-hidden="true">
    <p>A pull quote lifts one line out of the text and
    sets it large.</p>
  </aside>

  <p>A second paragraph of sample text continues the column.
  The pull quote floats to the right, and the text flows
  around its left side and below it.</p>
  <p>A third paragraph closes the sample. In a narrow column
  the pull quote stops floating and sits between paragraphs
  at full width.</p>
</article>

CSS

/* the column is a container, so the pull quote can drop
   its float when the column is narrow */
.bq-article {
  container-type: inline-size;
  width: 100%;
  max-width: 36rem;
  font-size: .95rem;
  line-height: 1.7;
  color: #88888f;
}

.bq-article p {
  margin: 0 0 1rem;
}

.bq-article::after {
  content: "";
  display: block;
  clear: both;
}

.bq-pull {
  float: right;
  width: 45%;
  margin: .35rem 0 1rem 1.5rem;
  padding: 1rem 0;
  border-top: 3px solid #b8ff57;
  border-bottom: 1px solid #2a2a2d;
  quotes: "\201C" "\201D";
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.5rem;
  line-height: 1.25;
  color: #f0f0f0;
}

.bq-pull p {
  margin: 0;
}

.bq-pull p::before {
  content: open-quote;
  color: #b8ff57;
}

.bq-pull p::after {
  content: close-quote;
  color: #b8ff57;
}

@container (width < 30rem) {
  .bq-pull {
    float: none;
    width: auto;
    margin: 1.25rem 0;
  }
}

Testimonial card

The same figure, blockquote, figcaption structure as the main demo, but styled as a card with a border, a surface background and rounded corners. blockquote::before { content: open-quote } draws one large mark positioned against the card as a watermark, and blockquote::after { content: no-close-quote } keeps the quote nesting level balanced without drawing a second mark. The caption holds an initials circle and a name and role in placeholder text. The circle is aria-hidden="true" because the full name is in the caption text.

HTML

<figure class="bq-card">
  <blockquote>
    <p>A short quote from a happy customer goes here. Two or
    three lines is plenty for a card like this one.</p>
  </blockquote>
  <figcaption>
    <span class="bq-avatar" aria-hidden="true">CN</span>
    <span>
      <span class="bq-name">Customer name</span>
      <span class="bq-role">Job title</span>
    </span>
  </figcaption>
</figure>

CSS

.bq-card {
  position: relative;
  width: 100%;
  max-width: 24rem;
  margin: 0;
  padding: 1.75rem 1.75rem 1.5rem;
  border: 1px solid #2a2a2d;
  border-radius: 16px;
  background: #1c1c1e;
  overflow: hidden;
}

.bq-card blockquote {
  margin: 0;
  quotes: "\201C" "\201D" "\2018" "\2019";
  font-size: 1.05rem;
  line-height: 1.6;
  color: #f0f0f0;
}

/* positioned, so the text paints over the watermark */
.bq-card blockquote p {
  position: relative;
  margin: 0;
}

/* one big mark as a watermark */
.bq-card blockquote::before {
  content: open-quote;
  position: absolute;
  top: -.4rem;
  right: 1rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 10rem;
  line-height: 1;
  color: #c084fc;
  opacity: .3;
}

/* draws nothing, but closes the quote, so the next
   quote on the page starts at the first pair again */
.bq-card blockquote::after {
  content: no-close-quote;
}

.bq-card figcaption {
  display: flex;
  align-items: center;
  gap: .8rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid #2a2a2d;
}

.bq-avatar {
  display: grid;
  flex: none;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .02em;
  color: #1a0b2e;
  background: linear-gradient(135deg, #c084fc, #f472b6);
}

.bq-name {
  display: block;
  font-weight: 600;
  color: #f0f0f0;
}

.bq-role {
  display: block;
  font-size: .85rem;
  color: #88888f;
}

Classic left border, with a quote inside a quote

The familiar left-border blockquote with a sky accent border, a tinted background and small inline marks from p::before { content: open-quote } and p::after { content: close-quote }. The <q> element inside automatically gets the second pair from quotes because the browser has already raised the nesting level. The inner quote is italic to distinguish it from the outer text, and it needs no rule for its marks because the browser's own q style already uses open-quote and close-quote one level deeper.

HTML

<blockquote class="bq-classic">
  <p>The outer quotation uses the first pair of marks. When it
  quotes another source, <q>the inner quotation switches to
  the second pair</q>, with no extra markup.</p>
</blockquote>

CSS

.bq-classic {
  width: 100%;
  max-width: 32rem;
  margin: 0;
  padding: 1rem 1.25rem;
  border-left: 4px solid #38bdf8;
  background: rgba(56, 189, 248, .12);
  quotes: "\201C" "\201D" "\2018" "\2019";
  font-size: 1.05rem;
  line-height: 1.65;
  color: #f0f0f0;
}

.bq-classic p {
  margin: 0;
}

/* the outer marks. A q inside takes the second pair on
   its own: the browser's q style is open-quote and
   close-quote too, one level deeper */
.bq-classic p::before {
  content: open-quote;
}

.bq-classic p::after {
  content: close-quote;
}

.bq-classic q {
  font-style: italic;
}

Understand it

How it works and 6 properties

A blockquote in CSS can be styled with large quotation marks generated from the quotes property and ::before { content: open-quote }. The demo below uses four curly quotes written as escape sequences, positions them as oversized pseudo-elements, and crops each one to the top half of its glyph so the box does not hang far below the visible mark. The attribution sits outside the quote, which is where it belongs.

Three variants follow: a pull quote that floats beside a column of text and drops its float in a narrow container through a @container query, a testimonial card with an initials circle and a watermark mark behind the text, and the familiar left-border style with a nested quote inside. The last one shows how open-quote and close-quote manage nesting.

How it works

The quotes property on the blockquote sets two pairs: double curly marks for the outer quote and single marks for a quote inside it. ::before { content: open-quote } and ::after { content: close-quote } generate the opening and closing marks at 10rem, positioned absolutely at the top left and bottom right. Each one has height: .5em, which crops the box to the upper half where the quote glyph sits, so the mark does not take up vertical space below where it is visible. The credit sits outside the blockquote in a figcaption. The HTML specification shows a figure with a blockquote and a figcaption as one way to relate a quote to its attribution, because attribution is not part of the quotation itself.

The marks are generated content, not text in the markup. content: open-quote tells the browser to draw the first character from the quotes string, and content: close-quote draws the second. The browser keeps a nesting level internally: open-quote raises it by one and close-quote lowers it by one, so a quote inside a quote gets the second pair automatically. That is how the classic variant works. The outer paragraph uses open-quote and close-quote, which raises the level to 1, and the <q> element inside picks up the single marks from the second pair with no additional rule needed.

A common mistake is to write the marks as literal strings, content: "\201C", instead of open-quote. The literal string draws the same glyph but does not touch the nesting count, so an inner quote gets double marks again instead of switching to single. The testimonial card shows the other trap: it draws one mark with open-quote but needs content: no-close-quote instead of content: "" to balance the count without drawing a second mark. The difference matters because every block on the page shares one global quote level. Leave it raised and the next <q> on the page gets the wrong pair.

The cite element wraps the work title, not the person's name. cite represents the title of a work and must not be used to mark up people's names. That is why the demo puts the author in plain text and only the work title in <cite>.

Pull quotes repeat text that is already in the article, so aria-hidden="true" on the aside hides the duplication from assistive technology. The words float to the right at 45% width and a @container (width < 30rem) query turns the float off when the column is too narrow for a side float to fit. The breakpoint is in rem, which resolves against the root font size, not the container's own font. The article clears the float with ::after { content: ""; display: block; clear: both } so a tall pull quote cannot hang out of the bottom.

Accessibility notes

Generated marks are not selectable text. A person copying the quote gets the words but not the punctuation, which is usually the correct behavior. The marks are decoration, and the quotation is complete without them.

The pull quote must be hidden from assistive technology when it repeats text that is already in the article. aria-hidden="true" on the aside keeps the duplication out of the reading order. Without it the same words appear twice in the accessibility tree.

The testimonial card caption holds "Customer name" and "Job title" in placeholder text that should be replaced with the actual person's name and role when the card goes live. The initials circle is marked aria-hidden="true" because the full name is in the caption, so the circle adds no information.

Mistakes worth avoiding

  • Using content: "\201C" instead of content: open-quote. The literal string draws the mark but does not raise the nesting level, so a <q> inside the blockquote gets double marks instead of single.
  • Forgetting no-close-quote when only one mark is drawn. The testimonial card draws an opening mark but no closing mark, so it needs no-close-quote to keep the count balanced or every quote after it on the page gets the wrong pair.
  • Putting the attribution inside the blockquote. Attribution belongs outside the quote. A figure with a blockquote and a figcaption as siblings is one way to structure this.
  • Using cite for the person's name. The cite element is for the title of a work, not for marking up names.
  • Leaving a pull quote visible to assistive technology. When the pull quote repeats text from the article, aria-hidden="true" keeps the duplication out of the accessibility tree.

Ship it

3 features in 4 browsers, 5 questions

Browser support

Feature Chrome Firefox Safari Edge
::before content423.112
quotes111.5912
container queries10611016106

Figures come from Can I Use for CSS Generated Content and Container Queries, and from MDN browser-compat-data for quotes. The Can I Use data this site checks against has no entry for quotes, so that row has no link. Support for generated content is old and even. Container queries shipped in Safari 16.

What you can build with it

  • Article pull quotes. A line lifted from the text and set large beside it, so a reader skimming the page catches the point without reading every paragraph.
  • Testimonial and review cards. Short quotes from customers or users on a landing page or about page, each in its own card with a photo or initials and a name.
  • Academic and legal citations. Block quotations in papers, briefs or documentation where the source and the quote need to be visually distinct and the attribution must sit outside the quoted text.
  • Nested quotations. A quote that contains another quote, where the inner one needs different marks and open-quote handles the nesting automatically without any extra markup.
  • Interview transcripts. Question and answer text where each speaker's words are set off as a blockquote, with the speaker's name in a figcaption or a heading above it.

Frequently asked questions

How do I style a blockquote in CSS?
Use the quotes property to define the quotation marks and ::before { content: open-quote } and ::after { content: close-quote } to generate them. Position the blockquote with position: relative and the marks with position: absolute, and put the attribution in a figcaption outside the blockquote.
Where does the attribution go in a blockquote?
Outside the blockquote element. Attribution is not part of the quotation. The HTML specification shows a figure wrapping both the blockquote and a figcaption as one way to structure this.
How do nested quotes get different marks?
The browser keeps a quote nesting level. open-quote raises the level and picks the matching pair from quotes, so a <q> inside a paragraph that already used open-quote automatically gets the second pair. The nesting happens without any extra class or markup.
Why does my inner quote have double marks instead of single?
The outer quote is using a literal string like content: "\201C" instead of content: open-quote. A literal string draws the mark but does not raise the nesting level, so the browser still thinks it is at level zero and gives the inner quote the first pair again.
Can I use the cite element for the author's name?
No. cite is for the title of a work, not for people's names. Put the person's name in plain text and only wrap the work title in <cite>.