CSS Quotation Marks: quotes, ::before and Escapes
November 11, 2026 · 10 min read
CSS Quotation Marks: The quotes Property, ::before, and Escapes
You control CSS quotation marks in three ways. The quotes property picks which marks appear, content: open-quote inserts them through ::before and ::after, and hex escapes like \201C type a curly mark directly. This guide gives a copy-ready snippet for each, plus the screen-reader catch and a recipe for rendered Markdown.
How the CSS quotes Property Picks Quotation Marks
The quotes property sets the marks a browser draws for the q element and for the open-quote and close-quote keywords. It's inherited, so one rule on a container covers everything inside it. Left at its default, it typically resolves to auto. That value picks marks to suit the element's language, which usually comes from a lang attribute on it or an ancestor, per MDN's quotes reference.
/* Double marks outside, single marks for a quote inside a quote */
article {
quotes: "\201C" "\201D" "\2018" "\2019";
}
/* Guillemets for one section, whatever its lang says */
.guillemets {
quotes: "\00AB" "\00BB" "\2039" "\203A";
}
Each pair of strings is one nesting level. The first pair wraps the outer quote, the second wraps a quote inside it, and any deeper level reuses the last pair. Here's that first rule applied to a nested quotation:
<article>
<p>She said, <q>He told me <q>wait here</q> and left.</q></p>
</article>
The browser renders it as: She said, “He told me ‘wait here’ and left.” You never type a mark, and swapping the quotes value restyles every quotation on the site at once.
Two other values round it out. quotes: none makes the quote keywords produce nothing at all. quotes: auto resets a descendant to language-based marks, so a section with lang="de" gets German-style marks on every q without a custom list.
open-quote and close-quote in ::before and ::after
The content property has four quote keywords. open-quote and close-quote insert the mark for the current depth, taken from quotes. no-open-quote and no-close-quote change the depth without drawing anything, which helps when one quotation runs across several paragraphs.
Browsers already apply this to q. The HTML rendering spec gives every browser a default q::before rule with content: open-quote and a matching q::after rule with close-quote. You can give any element the same behaviour:
.pull-quote::before {
content: open-quote;
}
.pull-quote::after {
content: close-quote;
}
An element with the pull-quote class now opens and closes with the first pair from quotes. A q nested inside it automatically picks up the second pair, because the browser tracks the depth for you.
We prefer quotes plus open-quote over hard-coded \201C for anything a reader treats as a quotation. With quotes: auto the marks follow lang, and the browser always tracks nesting depth. A translated page or a quote inside a quote stays correct without touching the stylesheet. A single decorative glyph is the exception, as you'll see below.
How Do I Insert Curly Quotation Marks in CSS?
Put the mark inside a content string, either as the character itself or as a hex escape. A literal “ works when your stylesheet is saved and served as UTF-8. Escapes are safer when you aren't sure of the encoding, because they're plain ASCII. These are the CSS quote marks you'll reach for most:
| Mark | Name | CSS escape |
|---|---|---|
| “ | Left double quotation mark | \201C |
| ” | Right double quotation mark | \201D |
| ‘ | Left single quotation mark | \2018 |
| ’ | Right single quotation mark (also the apostrophe) | \2019 |
| « | Left-pointing double angle quotation mark | \00AB |
| » | Right-pointing double angle quotation mark | \00BB |
| „ | Double low-9 quotation mark | \201E |
| " | Straight double quote | \0022 |
| ' | Straight single quote | \0027 |
A CSS escape is a backslash followed by one to six hex digits. According to the CSS Syntax spec, one whitespace character straight after those digits gets consumed as the end of the escape. That rule catches people when the next character is a digit or a letter from A to F:
.decade::before {
content: "\2019 90s"; /* renders ’90s */
}
.broken::before {
content: "\201990s"; /* reads 201990 as one number and renders �s */
}
The space in the first rule ends the escape and never appears on screen. If you want a visible space after the mark, type two spaces. HTML character references such as ” don't work inside CSS strings at all. They belong in markup, and our guide to quotes in HTML covers them alongside the q and blockquote tags.
Big Decorative Quote Marks With ::before
A large opening mark beside a testimonial or pull quote is one absolutely positioned pseudo-element. The parent gets position: relative and some left padding, and the glyph sits in that padding.
.testimonial {
position: relative;
padding-left: 3.5rem;
}
.testimonial::before {
content: "\201C";
position: absolute;
left: 0;
top: -0.2em;
font-family: Georgia, serif;
font-size: 4.5rem;
line-height: 1;
color: #9ca3af;
}
line-height: 1 stops the oversized glyph from stretching the box, and the negative top lines the mark up with the first line of text. Georgia gives the mark a classic curled shape, but any serif with real curly glyphs works. For the rest of the box, our blockquote style designs cover accent bars, tinted cards and centered pull quotes.
Use a string here, not open-quote. An open-quote without a matching close-quote leaves the nesting depth raised, so every later q on the page would get your inner pair of marks. Also drop any quote marks typed into the text itself, or you'll see two.
Do Screen Readers Announce CSS Quote Marks?
Sometimes. MDN's content reference warns that certain browser and screen reader combinations won't announce generated content, so behaviour isn't consistent. Where it is announced, a decorative mark may be read aloud, depending on the user's punctuation settings. That adds noise before every testimonial.
The content property accepts alternative text after a slash. An empty string marks the glyph as decorative:
.testimonial::before {
content: "\201C"; /* fallback for older browsers */
content: "\201C" / ""; /* empty alt text: decorative */
}
MDN's compatibility data lists support from Chrome 77, Firefox 128 and Safari 17.4. Browsers that don't understand the slash drop the second declaration as invalid and keep the first, so the mark still shows.
The limitation: you can't fully control what each screen reader says, and testing every combination isn't realistic. For quotations where the marks carry meaning, leave them exposed and don't add empty alt text.
Adding Quote Marks to Rendered Markdown With .markdown-body
In standard Markdown, > produces a blockquote element, and no Markdown syntax produces q. Our Markdown blockquote guide covers the syntax itself. Browsers draw no marks on blockquote by default, so any marks in rendered Markdown come from your stylesheet.
If you style rendered Markdown with github-markdown-css, your content sits inside a .markdown-body wrapper that already gives blockquotes a left border and muted text. Our guide to Markdown CSS themes covers that setup. Scope the decorative mark to the wrapper:
.markdown-body blockquote {
position: relative;
padding-left: 3.5rem;
}
.markdown-body blockquote::before {
content: "\201C";
content: "\201C" / "";
position: absolute;
left: 0.5rem;
top: -0.2em;
font-size: 3.5rem;
line-height: 1;
color: #9ca3af;
}
Watch out for callouts. GitHub renders > [!NOTE] alerts as a div with the markdown-alert class, so a blockquote selector already skips them. If your renderer keeps Markdown callouts as blockquote elements with a class, exclude that class. If it's callout, the selector becomes .markdown-body blockquote:not(.callout)::before.
To check which element you're targeting, convert a quote to HTML below and find the blockquote element in the output.
Our editor's preview and the Markdown to HTML converter don't apply your own stylesheet. Paste the CSS into your site's stylesheet and test the result on your own page.
Quotation Marks Inside CSS Values: Strings, font-family, and url()
Some searches for quotation marks in CSS are really about quoting values. CSS strings take double or single quotes, and the two are interchangeable. To use the same quote inside a string, escape it with a backslash or switch the outer quote type:
.a::after { content: 'It\'s done'; }
.b::after { content: "It's done"; }
.c { font-family: "Times New Roman", serif; }
.d { background-image: url("images/hero (1).png"); }
.e[data-state="open"] { color: green; }
Both content rules print the same text. In font-family, MDN calls quoting names with spaces, digits or punctuation good practice. Generic families like serif and monospace are keywords and must not be quoted, because "serif" asks for a font literally named serif.
For url(), quotes are optional unless the address contains unescaped spaces, parentheses or quotes. Attribute selectors accept either quote type around the value.
Why Your CSS Quotation Marks Look Straight, Doubled, or Missing
Most broken quote marks trace back to one of these:
- Missing on
q: a CSS reset setsquotes: noneorcontent: noneonq::beforeandq::after. Eric Meyer's widely copied reset does both. Check the computed styles in DevTools. - Doubled: the text already contains typed marks and your CSS adds a second set. Remove one or the other.
- Wrong language: with
quotes: auto, marks follow the language inherited from the nearestlangattribute. A missing or wronglanggives the wrong style. - Straight instead of curly: your
quotesvalue orcontentstring uses straight characters such as'"'instead of curly marks or their escapes. - Inner marks where outer ones belong: an earlier unmatched
open-quoteraised the depth. Pair everyopen-quotewith aclose-quoteorno-close-quote. - A replacement character (�): a hex escape ran into a following digit or letter. Add a space after the escape.
Quick Answers on CSS Quote Marks
CSS quotation marks come down to three tools: quotes for which marks appear, open-quote and close-quote for where they go, and hex escapes for a single decorative glyph. Keep real quotations on the keywords, keep big decorative marks on strings with empty alt text, and scope Markdown rules to your wrapper. Draft your quotes in the editor, then convert them with the HTML converter to see the markup your CSS will target.