CSS hanging-punctuation Property

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The hanging-punctuation property controls whether punctuation may hang outside the line box at the start or end of a line. That keeps the main letters aligned while quotes or stops sit slightly outside the edge.

It applies to all elements, is inherited, and starts at none. You can combine keywords such as first last or first allow-end.

Limited availability.

Not Baseline. Works in Safari (and Safari on iOS). Chrome, Edge, and Firefox generally ignore it. Safe as progressive enhancement — unsupported browsers keep normal punctuation.

CSS Syntax

syntax.css
hanging-punctuation: none | first || last || allow-end | force-end | initial | inherit;

You may use one, two, or three keywords together (for example first last). allow-end and force-end cannot both be used.

Property Values

ValueDescriptionTry it
noneDefault. No character hangsTry it
firstOpening bracket or quote at the start of the first line hangsTry it
lastClosing bracket or quote at the end of the last line hangsTry it
first lastCombine start and end hangingTry it
allow-endStop or comma may hang at the end of a line if it does not fitTry it
inheritTakes the parent’s hanging-punctuationTry it

force-end forces a stop or comma to hang even when it would fit. Prefer allow-end for softer behavior.

How to Use hanging-punctuation

Use it on quoted text when you want optical alignment of the first letters.

  1. Wrap quoted copy in a block such as <p> or <blockquote>.
  2. Start the text with an opening quote or bracket if you use first.
  3. Set hanging-punctuation: first, last, or both.
  4. Check in Safari. Other browsers keep the punctuation inside the box.
PieceRequired?Role
Text with punctuationYesOpening/closing quotes, brackets, or end stops
hanging-punctuation keywordYesfirst, last, allow-end, and combinations
Supporting browserTo see the effectSafari today; others ignore the property

Live Preview

Toggle hanging on a quoted paragraph. In Safari, the opening « can sit outside the border. Elsewhere, the text still looks fine.

Limited support. The border shows the content box so hanging is easier to spot when the browser applies it.

Quote

«For a moment, nothing happened. Then, after a second or so, nothing continued to happen.»

hanging-punctuation: first

CSS Examples

Each snippet focuses on hanging-punctuation. Test in Safari to see hanging. Use Try It Yourself for a live editor.

Example 1 — Hang the Opening Quote

Let the opening punctuation sit outside the first line.

CSS
<style>
  p {
    hanging-punctuation: first;
  }
</style>

<p>&laquo;Hello from hanging punctuation.&raquo;</p>
Try It Yourself

How It Works

  1. Start with a quote. The first character is an opening mark («).
  2. Set first. hanging-punctuation: first asks that mark to hang outside the line box.
  3. Letters align. The main text edge looks cleaner beside nearby paragraphs.
  4. Safari shows it. Other browsers keep the quote inside — still readable.

Example 2 — Hang Both Ends

Combine first and last for opening and closing marks.

CSS
<style>
  p {
    hanging-punctuation: first last;
  }
</style>

<p>&laquo;Quoted line with both ends.&raquo;</p>
Try It Yourself

How It Works

  1. Use two keywords. Space-separated first last enables both behaviors.
  2. Opening hangs. The first-line opening mark can leave the box.
  3. Closing hangs. The last-line closing mark can leave the box.
  4. Still optional. Unsupported browsers ignore the property safely.

Example 3 — No Hanging

Keep punctuation fully inside the text box.

CSS
<style>
  p {
    hanging-punctuation: none;
  }
</style>

<p>&laquo;Default: punctuation stays inside.&raquo;</p>
Try It Yourself

How It Works

  1. Use none. This is the initial value.
  2. Quotes stay inside. Opening and closing marks remain within the line box.
  3. Predictable everywhere. Same look in Safari and Chromium.
  4. Good baseline. Turn hanging on only when you want the optical effect.

Edge Cases & Pitfalls

If nothing hangs, support or punctuation type is usually why.

support

Limited browser support

Chrome, Edge, and Firefox generally do not apply hanging-punctuation. Treat it as a Safari-friendly enhancement.

chars

Only certain characters hang

first / last target opening and closing brackets or quotes. allow-end targets stops and commas at line ends.

combine

allow-end vs force-end

Use one or the other, not both. allow-end hangs when needed; force-end forces hanging.

layout

Hanging can need side room

A tight parent with overflow: hidden may clip hanging marks. Leave a little padding outside the text edge.

align

Pairs well with text-align

Hanging is about optical edges. text-align still controls how lines are justified inside the box.

Browser Support

hanging-punctuation is a browser typography property. Node.js, Deno, and Bun do not apply it.

✓ Limited availability

hanging-punctuation

Safari 10+ (partial), stronger in Safari 17.4+. Chrome, Edge, and Firefox: not supported. Use as progressive enhancement.

18% Global reach (approx.)
Google Chrome No
None
Mozilla Firefox No
None
Apple Safari 10+ partial · 17.4+ stronger
Partial / Full
Microsoft Edge No
None
Opera No
None
Samsung Internet No
None
Internet Explorer No
None
hanging-punctuation Safari-first

Bottom line: Safe to ship as enhancement: unsupported browsers ignore it. Do not rely on hanging for critical layout.

Key Takeaways

  • Role: hang selected punctuation outside the line box for cleaner letter alignment.
  • Common values: none, first, last, allow-end (combinable).
  • Initial value: none. Inherited.
  • Support: Limited availability — Safari today; ignore elsewhere.

One line: hanging-punctuation pulls quotes outside the box so the text edge looks aligned — when the browser supports it.

Frequently Asked Questions

It lets certain punctuation marks hang outside the line box at the start or end of a line, so the main letters align more cleanly.
The initial value is none. Punctuation stays inside the normal text box.
first hangs an opening bracket or quote at the start of the first line. last hangs a closing bracket or quote at the end of the last line.
allow-end lets a stop or comma hang at the end of a line when it would not otherwise fit before justification.
No. It is Limited availability. Safari supports it; Chrome, Edge, and Firefox generally do not. Use it as progressive enhancement.
Safari (partial from 10, fuller in recent versions) and Safari on iOS. It is a browser typography property, not a Node.js feature.

Next: height

Learn how to set an element’s height.

height tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful