How to style HTML blockquotes with CSS

Use HTML <blockquote> for a standalone quotation and CSS for its border, background, and spacing. The example groups the quote and its source in a <figure> and puts an accent border on the reading-start side. You can also turn on a decorative quotation mark.

Mark up the quote and its source

Use <blockquote> for a quoted section and <q> for a short quotation within a sentence. To highlight your own prose, apply a class to the paragraph or container that fits its purpose.

The cite attribute on a blockquote can hold the source URL. It does not give readers a visible link by itself. Add a link in <figcaption> and use the <cite> element for the title of the document or work. Put an author’s name beside the title if needed.

HTML Standard rules for blockquote · HTML Standard rules for cite

Run the complete bordered quote example

Save this complete example as blockquote-demo.html in UTF-8 and open it in a browser. It needs no dependencies.

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Blockquote styling example</title>
<style>
body {
  max-width: 42rem;
  margin: 2rem auto;
  padding-inline: 1rem;
  font: 1rem/1.65 system-ui, sans-serif;
}
.quote {
  margin-block: 1.5rem;
  margin-inline: 0;
  padding: 1rem 1.25rem;
  border-inline-start: .35rem solid #2563eb;
  background: #eff6ff;
  color: #172554;
}
.quote blockquote { margin: 0; }
.quote blockquote p { margin: 0; overflow-wrap: anywhere; }
.quote figcaption { margin-block-start: .75rem; }
.quote__mark { display: none; }
.quote--decorative .quote__mark {
  display: block;
  color: #2563eb;
  font: 3rem/1 Georgia, serif;
}
</style>
</head>
<body>
<figure class="quote">
  <span class="quote__mark" aria-hidden="true">“</span>
  <blockquote cite="https://html.spec.whatwg.org/multipage/grouping-content.html#the-blockquote-element">
    <p lang="en" dir="ltr">The blockquote element represents a section that is quoted from another source.</p>
  </blockquote>
  <figcaption>
    <a href="https://html.spec.whatwg.org/multipage/grouping-content.html#the-blockquote-element" lang="en"><cite>HTML Standard</cite></a>
  </figcaption>
</figure>
</body>
</html>

The example shows a pale blue card, a blue border on the start side, and a link to the quoted document. margin-inline: 0 removes the card’s side margins, while padding leaves space inside it. The scoped blockquote rule clears the browser’s default quote indentation.

Add decoration and test text direction

The optional mark is a <span> outside the quotation. The attribute aria-hidden="true" hides only the decorative symbol from the accessibility tree, leaving the quotation and source link available.

  1. Change class="quote" to class="quote quote--decorative". A large quotation mark appears above the text. Restore the original class to hide it.
  2. Temporarily add dir="rtl" to <figure>. In horizontal text, border-inline-start places the accent on the right. Remove the attribute to move it back.

W3C flow-relative border properties

Check the style on mobile and in your theme

Scope the CSS to your quote class so it does not affect other quotes in the theme. If the border is missing or the quote has too much indentation, inspect the figure’s computed start border and the nested blockquote’s margins separately.

Check that text wraps inside the card on a narrow screen and that the source link is easy to reach. The example uses overflow-wrap: anywhere to let unusually long words wrap. If you change the colors, keep the text legible against its actual background.

Marking up blockquotes and source attribution