CSS / Reference / quotes: Choose Nested Quotation Marks
The CSS quotes property selects the quotation marks generated by open-quote and close-quote. Supply opening and closing strings in pairs to give nested quotations different marks. Use no-open-quote and no-close-quote to hide a pair while preserving its effect on quote depth.
Values of the quotes property
The property is inherited. A value set on an article container can reach each <q> inside it. The property supplies the marks. Browser defaults or the content rules on ::before and ::after determine where they go.
| Value | Behavior |
|---|---|
auto |
The initial value. The browser selects marks for the surrounding content language. |
none |
Hides generated quotation marks. Punctuation typed into the HTML remains visible. |
"«" "»" |
Uses the same pair at every depth. |
"«" "»" "‹" "›" |
Uses the first pair outside and the second inside. Deeper quotations reuse the last pair. |
CSS Generated Content specification for quotes
Run the example in a browser
Save the following as quotes-example.html in UTF-8 and open it in a browser. The first two lines use the same pairs, with the outer pair suppressed on the second line.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Nested quotation marks</title>
<style>
body { margin: 1rem; font: 1rem/1.65 system-ui, sans-serif; }
main { max-inline-size: 44rem; margin-inline: auto; overflow-wrap: anywhere; }
.sample { padding: 0.6rem 0.85rem; background: #edf3fc; }
.sample p { margin: 0.35rem 0; }
.pairs { quotes: "«" "»" "‹" "›"; }
.none { quotes: none; }
.automatic { quotes: auto; }
q::before { content: open-quote; }
q::after { content: close-quote; }
.silent > q::before { content: no-open-quote; }
.silent > q::after { content: no-close-quote; }
</style>
</head>
<body>
<main>
<h1>Nested quotation marks</h1>
<div class="sample">
<p id="pairs" class="pairs"><q>Outer quotation <q>Inner quotation <q>Deepest quotation</q></q></q></p>
<p id="silent" class="pairs silent"><q>Outer quotation <q>Inner quotation</q></q></p>
<p id="none" class="none"><q>No generated marks</q> · “Typed punctuation”</p>
</div>
<h2>Automatic marks by parent language</h2>
<div class="sample automatic">
<p id="auto-en" lang="en">English context: <q lang="fr">Bonjour</q></p>
<p id="auto-fr" lang="fr">Contexte français : <q lang="en">Hello</q></p>
</div>
</main>
</body>
</html>
The first line uses « » outside and ‹ › at both deeper levels. The second line shows just the inner ‹ ›. The third line keeps the typed “ ”.
How quotation depth changes
open-quote inserts the opening mark for the current depth, then increases the depth. close-quote decreases it and selects the closing mark for the resulting depth. Keep the two rules paired so their effects on later quotations balance.
no-open-quote and no-close-quote adjust the depth without drawing a mark. Applying them to both sides of the outer quotation leaves the inner quotation on the second pair. Setting content: none on both outer pseudo-elements removes those depth changes, so the inner quotation uses the first pair.
CSS quotation keyword behavior
Automatic marks and language
With auto, the browser chooses marks for the language of the parent content. Compare the French quotation in the English paragraph with the English quotation in the French paragraph. The exact marks and spacing can vary by browser. Set lang on the document and where the surrounding content changes language.
Use <q> for a short quotation inside a sentence. Typing the same marks inside it can double the punctuation when the browser also generates them. Use <blockquote> for a block quotation and style its punctuation separately if needed.
Troubleshoot unexpected marks
- Inspect the quotation and check the computed
quotesvalue it inherits. - Check the computed
contenton both pseudo-elements. An overriding rule can change the displayed marks and the depth. - To change typography for one part of the site, scope the selector to that container.





