Skip to content
Tutorials Center
My learning

Topics

CSS Reference ยท Typography

The quotes property

Reference for the CSS quotes property: choose the quotation marks used by the q element and open-quote and close-quote, with nesting levels and a live example.

The quotes property defines the quotation marks that browsers insert around quoted content. It affects the HTML <q> element and any generated content that uses the open-quote and close-quote keywords of the content property.

You give pairs of strings: the first pair is for the outermost quote, the second pair for a quote nested inside it, and so on. That lets you follow the typographic rules of a language, for example guillemets in French or low-high quotes in German.

CSS
q {
  quotes: "ยซ" "ยป" "โ€น" "โ€บ";
}

Try it

Custom quotes and nesting

Each paragraph styles the same markup differently: the outer <q> uses the first pair, the inner one uses the second pair, and none removes the marks entirely.

Syntax

CSS
quotes: auto | none | match-parent | [ <string> <string> ]+;
Initial value depends on the user agent (usually quotation marks for the content's language)
Applies to all elements
Inherited yes
Animatable no
Computed value as specified

Values

Value Description
auto The browser picks marks that suit the language set by lang on the element or its ancestors.
none open-quote and close-quote produce nothing.
match-parent Takes the quote pairs of the parent element, so nested quotes continue the same set. Mainly used by browsers' default styles.
<string> <string> One or more pairs: opening mark then closing mark. The first pair is for depth 1, the second for depth 2, and so on. If nesting goes deeper than the pairs given, the last pair is reused.

Usage notes

  • <q> and content. The browser's built-in style for q::before is content: open-quote and q::after is content: close-quote. Because of that, the quotes property affects <q> without extra rules. For other elements, add the content yourself, as in blockquote p::before { content: open-quote; }.
  • Set lang. With the defaults, quotation style depends on the document language, so <html lang="fr"> produces French quotes without any CSS. Custom quotes is only needed when you want something different.
  • Nested depth is counted per element tree. Depth increases for each open quote that is not yet closed, including quotes from content.
  • no-open-quote and no-close-quote keywords for content change the depth without printing a mark, useful for quotes that continue across paragraphs.
  • The marks are generated. They are not selectable or searchable. If the quote marks must be copied with the text, put them in the HTML.
  • Screen readers may or may not read generated quote marks.

Browser support

Supported in every browser.