CSS hanging-punctuation Property

Beginner
⏱️ 5 min read
📚 Updated: Jun 2026
🎯 4 Examples
Typography

What You’ll Learn

The hanging-punctuation property lets punctuation marks hang outside the text box so lines of body text align more cleanly.

01

Punctuation

Quote marks.

02

none

Default.

03

first

Opening mark.

04

last

Closing mark.

05

Typography

Clean edges.

06

Support

Limited.

Introduction

The hanging-punctuation property in CSS allows you to control the positioning of punctuation marks in relation to the surrounding text. This property is particularly useful for creating typographic effects, such as when you want punctuation marks to hang outside of the main text block for a cleaner, more visually appealing layout.

Definition and Usage

Apply hanging-punctuation on block-level text containers such as paragraphs, blockquotes, or articles. It works best with narrow columns and quoted text where opening or closing marks would otherwise push body text inward.

💡
Beginner Tip

Browser support for this property is limited. Treat it as a progressive enhancement for typography, not a requirement for readable layout.

📝 Syntax

The syntax for the hanging-punctuation property is as follows:

syntax.css
element {
  hanging-punctuation: value;
}

The value can be one or more of the keywords below, separated by spaces:

  • none
  • first
  • last
  • first last
  • allow-end
  • allow-start

Basic Example

hanging-punctuation-basic.css
p {
  width: 200px;
  hanging-punctuation: first;
}
hanging-punctuation: none; hanging-punctuation: first; hanging-punctuation: first last;

Default Value

The default value of the hanging-punctuation property is none, which means that no special hanging behavior is applied to punctuation marks.

Syntax Rules

  • Applies to block containers that hold text.
  • Accepts keyword values and combinations like first last.
  • The property is inherited.
  • Works best with narrow widths and punctuation-heavy content.
  • Support varies by browser; test before relying on it in production.

⚡ Quick Reference

QuestionAnswer
Initial valuenone
Applies toBlock containers
InheritedYes
ControlsPunctuation placement at line edges
Browser supportLimited (best in Safari)

💎 Property Values

ValueDescription
noneNo hanging punctuation is applied. Punctuation marks stay in their normal position.
firstThe punctuation mark at the beginning of a line hangs outside the block
lastThe punctuation mark at the end of a line hangs outside the block
first lastBoth opening and closing punctuation at line edges may hang outside the block
allow-endAllows end punctuation to hang outside when it improves visual alignment
allow-startAllows start punctuation to hang outside when it improves visual alignment

👀 Live Preview

A narrow paragraph with hanging-punctuation: first (effect visible in supporting browsers):

“Hello there!” This paragraph demonstrates how hanging punctuation can improve quote alignment in narrow columns.

Examples Gallery

Hang opening quotes with first, closing marks with last, combine both, and compare against the default none value.

🔢 Hanging Punctuation

Start with the reference example — opening punctuation hanging outside the text block.

Example 1 — Hang Opening Punctuation

Make the opening quotation mark at the start of a line hang outside the text box.

hanging-punctuation-first.css
p {
  width: 200px;
  border: 1px solid #ccc;
  padding: 10px;
  hanging-punctuation: first;
}
Try It Yourself

How It Works

With first, the opening quote can sit outside the content box so the first letter of the line aligns with the rest of the paragraph text.

Example 2 — Hang Closing Punctuation

Allow closing punctuation at the end of a line to hang outside the block.

hanging-punctuation-last.css
blockquote {
  max-width: 16rem;
  hanging-punctuation: last;
}
Try It Yourself

How It Works

last targets closing punctuation at the end of a line, helping quoted passages end with cleaner right edges.

📈 Combined Values

Use multiple keywords and compare against the default behavior.

Example 3 — first and last Together

Hang both opening and closing punctuation at line edges.

hanging-punctuation-both.css
.quote {
  max-width: 18rem;
  hanging-punctuation: first last;
}
Try It Yourself

How It Works

first last combines both behaviors so quote marks at either edge of a line can hang outside the text box.

Example 4 — none vs first Comparison

See how the default none value differs from first on the same quoted text.

hanging-punctuation-compare.css
.normal { hanging-punctuation: none; }
.hanging { hanging-punctuation: first; }
Try It Yourself

How It Works

With none, punctuation stays inside the content box. With first, the opening mark can extend left for cleaner alignment.

♿ Accessibility

  • Do not rely on hanging punctuation for meaning — the text must remain readable without the visual effect.
  • Keep sufficient line length so quoted passages remain easy to read.
  • Test with screen readers — punctuation is still announced normally in supporting browsers.
  • Provide fallbacks since unsupported browsers ignore the property safely.
  • Maintain contrast between text, punctuation, and background.

🧠 How hanging-punctuation Works

1

Text reaches a line edge

A line starts or ends with a punctuation mark such as a quote or period.

Line break
2

hanging-punctuation is set

Keywords like first or last tell the browser which marks may hang.

CSS rule
3

Browser adjusts placement

In supporting browsers, punctuation can render outside the content box edge.

Rendering
=

Cleaner text alignment

Body text lines up evenly even when quotes appear at the edges.

🖥 Browser Compatibility

The hanging-punctuation property has limited browser support. It is most reliable in Safari and other WebKit-based browsers. Chrome, Firefox, and Edge may not apply the effect.

Limited · Progressive enhancement

Check before you rely on it

Treat hanging punctuation as an optional typography enhancement, not a layout requirement.

28% Modern browser support
Apple Safari 10+ · macOS & iOS
Full support
Google Chrome Desktop & Mobile
Not supported
Mozilla Firefox Desktop & Mobile
Not supported
Microsoft Edge Chromium
Not supported
Opera Chromium-based
Not supported
hanging-punctuation property 28% supported

Bottom line: Use as progressive enhancement. Text remains readable when the property is ignored.

🎉 Conclusion

The hanging-punctuation property offers a useful way to enhance typographic aesthetics by controlling the placement of punctuation marks. By experimenting with different values, you can achieve visual effects that contribute to a more polished and professional look for your text content.

Because browser support is limited, use it as an enhancement rather than a core layout technique. Start with first on narrow quoted paragraphs and test in Safari and other target browsers.

💡 Best Practices

✅ Do

  • Use on narrow quoted text and blockquotes
  • Try first for opening quotation marks
  • Treat it as progressive enhancement
  • Test in Safari and target browsers
  • Keep text readable without the effect

❌ Don’t

  • Rely on it for critical layout alignment
  • Assume Chrome or Firefox support
  • Use on very wide paragraphs where effect is subtle
  • Hide punctuation meaning from assistive tech
  • Forget fallback styling for all browsers

Key Takeaways

Knowledge Unlocked

Five things to remember about hanging-punctuation

Use these points when refining quote typography.

5
Core concepts
none 02

Default none

Normal.

Default
first 03

Opening

Start line.

Syntax
last 04

Closing

End line.

Pattern
Safari 05

Limited

Enhance only.

Support

❓ Frequently Asked Questions

hanging-punctuation controls whether punctuation marks at the start or end of a line hang outside the text box for cleaner alignment.
The default is none, which means punctuation stays in its normal position within the text block.
first hangs opening punctuation at the start of a line. last hangs closing punctuation at the end of a line.
Support is limited. It works best in Safari and WebKit-based browsers. Chrome and Firefox may not apply the effect.
Yes. hanging-punctuation is inherited, so you can set it on a parent element like blockquote or article.

Practice in the Live Editor

Open the HTML editor, change hanging-punctuation values, and compare quote alignment in narrow columns.

HTML Editor →

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.

5 people found this page helpful