CSS Hanging Punctuation Generator
Control hanging punctuation for refined typography
Preset
Hangs opening quotes and brackets at the start of the first line
Target Element
hanging-punctuation
Current value: first
Text Alignment
Text Indent (Optional)
Preview Settings
Generated CSS
p {
hanging-punctuation: first;
}Live Preview
Note: hanging-punctuation is currently only supported in Safari. Other browsers will show normal punctuation alignment.
Without Hanging Punctuation
"βTypography is what language looks like.β β Ellen Lupton"
With Hanging Punctuation
"βTypography is what language looks like.β β Ellen Lupton"
Multiple Quotes Preview
βTypography is what language looks like.β β Ellen Lupton
βGood typography is invisible, bad typography is everywhere.β β Oliver Reichenstein
βThe dumbest mistake is viewing design as something you do at the end of the process.β β Tom Greever
hanging-punctuation Keywords
none
No hanging punctuation
Affects: None
first
Opening bracket or quote at the start of the first line hangs
Affects: ββ'([{γγ
last
Closing bracket or quote at the end of the last line hangs
Affects: ββ')]}.!?,;:γγ
force-end
Period or comma at the end of any line hangs
Affects: .,γγ
allow-end
Period or comma may hang if it doesn't fit on the line
Affects: .,γγ
Affected Punctuation Characters
First (Opening)
U+201CU+2018U+00ABU+0028U+005BU+007BU+300CU+300ELast (Closing)
U+201DU+2019U+00BBU+0029U+005DU+007DU+300DU+300FU+0021U+003FU+003BU+003AForce-End / Allow-End
U+002EU+002CU+3002U+3001Examples
Basic Quote Hanging
Hang opening quotes for elegant blockquotes
blockquote {
hanging-punctuation: first;
text-align: left;
font-size: 1.25rem;
line-height: 1.6;
}Full Hanging for Prose
Complete hanging for professional book-style text
article p {
hanging-punctuation: first force-end last;
text-align: justify;
hyphens: auto;
}Pull Quote Styling
Large decorative pull quotes with hanging punctuation
.pullquote {
hanging-punctuation: first last;
font-size: 2rem;
font-style: italic;
text-align: center;
margin: 2rem 0;
padding: 1rem;
border-left: 4px solid #3b82f6;
}Japanese Text
Hanging punctuation for CJK content
.japanese-text {
hanging-punctuation: first allow-end last;
text-align: justify;
word-break: break-all;
line-height: 1.8;
}First Paragraph Drop Cap
Combine with first-line pseudo-element
article p:first-of-type {
hanging-punctuation: first;
}
article p:first-of-type::first-letter {
float: left;
font-size: 3.5em;
line-height: 0.8;
margin-right: 0.1em;
font-weight: bold;
}Responsive Hanging
Enable hanging only on larger screens
blockquote {
hanging-punctuation: none;
}
@media (min-width: 768px) {
blockquote {
hanging-punctuation: first last;
}
}Reference
Syntax
hanging-punctuation: none; hanging-punctuation: first; hanging-punctuation: last; hanging-punctuation: force-end; hanging-punctuation: allow-end; hanging-punctuation: first last; hanging-punctuation: first force-end; hanging-punctuation: first allow-end; hanging-punctuation: first force-end last; hanging-punctuation: first allow-end last;
Values Explained
| Value | Position | Characters | Behavior |
|---|---|---|---|
none | - | - | No hanging (default) |
first | First line start | Opening quotes/brackets | Always hangs if at start |
last | Last line end | Closing punctuation | Always hangs if at end |
force-end | Any line end | Period, comma | Always hangs at line end |
allow-end | Any line end | Period, comma | Hangs only if needed for justification |
Browser Support
| Browser | Support | Notes |
|---|---|---|
| Safari | Yes (10+) | Full support |
| Chrome | No | Not implemented |
| Firefox | No | Not implemented |
| Edge | No | Not implemented |
As of 2024, hanging-punctuation is only supported in Safari. Consider using it as a progressive enhancement.
Best Practices
- Use as progressive enhancement: Since support is limited, ensure your design works without it.
- Combine with good typography: Use with appropriate line-height, font-size, and measure (line length).
- first is most impactful: Opening quote hanging is the most visually noticeable and commonly desired effect.
- Choose force-end vs allow-end wisely: force-end is predictable; allow-end adapts to line breaks in justified text.
- Test with real content: The effect varies based on which punctuation appears at line boundaries.
- Works best with larger text: The visual improvement is more noticeable at larger font sizes like pull quotes.
Why Use Hanging Punctuation?
Visual Alignment
Creates a cleaner left edge by aligning the actual letters rather than punctuation marks.
Professional Typography
A technique used in high-quality print design, now available for web.
Better Readability
Improves the flow of text by maintaining consistent visual margins.
Enhanced Quotes
Makes blockquotes and pull quotes look more polished and intentional.