Skip to content
Tutorials Center
My learning

Topics

CSS Reference Β· Typography

The hanging-punctuation property

Reference for the CSS hanging-punctuation property: let opening quotes and closing marks hang outside the text box. Syntax, values, example, limited support.

In well-set typography, an opening quotation mark at the start of a paragraph does not push the first letter inwards. It hangs into the margin, so the left edges of the letters line up. The hanging-punctuation property does the same on the web: it lets some punctuation sit outside the edge of the text box.

This is a fine detail and it has limited browser support: at the time of writing, it is implemented mainly in Safari. Treat it as an enhancement, and add a fallback if the alignment matters.

CSS
blockquote {
  hanging-punctuation: first;
}

Try it

Hanging an opening quote

In supporting browsers, the opening mark of the second quote sticks out to the left of the "T" alignment line of the box, so the letter lines up with the text below. In others, the first two quotes look the same. The third shows the common manual fallback.

Syntax

CSS
hanging-punctuation: none | [ first || [ force-end | allow-end ] || last ];
Initial value none
Applies to text
Inherited yes
Animatable no
Computed value as specified

Values

Value Description
none No punctuation hangs.
first An opening bracket or quote at the start of the first line hangs outside the box.
last A closing bracket or quote at the end of the last line hangs outside the box.
force-end A stop or comma at the end of a line hangs, forced even when it would fit. Helpful with justified text.
allow-end A stop or comma at the end of a line hangs only if it would not fit otherwise.

Values can be combined, for example first allow-end last.

Usage notes

  • Hanging punctuation needs room. The punctuation extends beyond the box, so there must be a margin or padding outside the text box, or it will be clipped or overflow.
  • Not reliable across browsers. Without support, the text shows normally, which is acceptable for most designs. For a blockquote, a negative text-indent equal to the width of the mark is a common manual alternative; it is tied to one font and one quote character, so use it carefully.
  • Best with justified text. force-end keeps the right edge tidy when text-align: justify is used.
  • Does not apply to all punctuation. Which characters hang is defined by the specification and the font; only some quote, bracket, stop and comma characters qualify.
  • Related generated quotes. If you add quote marks with quotes and ::before, hanging does not apply to generated content in every case. Put the quote in the text if alignment matters.

Browser support

Limited: supported in Safari, and not in most other browsers at the time of writing. Check a compatibility table before relying on it.