text‑spacing CSS Demo - Online trim‑start & space‑first
New CSS text‑spacing property for fine control over punctuation spacing. See the effect live. For advanced typography.
UD5 Toolkit
Interactive playground for CSS text indentation and hanging punctuation — see how these properties refine typography in real-time.
#enable-experimental-web-platform-features flag enabled.
text-indent in CSS?text-indent controls the indentation of the first line of a block of text. Positive values push the first line to the right (like a traditional paragraph indent), while negative values pull it to the left — creating a hanging indent (common in bibliographies and reference lists). It accepts units like px, em, rem, %, and ch. The property is inherited and applies to block-level elements.
hanging-punctuation and why should I care?hanging-punctuation allows certain punctuation marks (like quotation marks, periods, and commas) to hang outside the text block's edges. This creates optically smoother alignment — the text characters themselves align perfectly, while punctuation sits slightly outside. It's a subtle but powerful typographic refinement used in professional typesetting. Values include none, first (opening quotes on the first line), last (closing punctuation on the last line), force-end (all line-end punctuation), and allow-end (conditional hanging).
hanging-punctuation?As of 2025, Safari (both macOS and iOS) provides full support for hanging-punctuation. Chrome and Edge offer partial support behind the #enable-experimental-web-platform-features flag (enter chrome://flags in the address bar to enable). Firefox does not currently support this property. For cross-browser projects, consider it a progressive enhancement — the text remains perfectly readable even without support.
They complement each other beautifully! For example, you might use text-indent: 30px to indent the first line of a paragraph, then add hanging-punctuation: first so that if the paragraph starts with a quotation mark, it hangs outside the indent — keeping the actual text character perfectly aligned with the indentation point. This is especially elegant in book typography and editorial design.
A hanging indent (achieved with a negative text-indent plus matching padding-left) is where the first line extends to the left of the rest of the paragraph. It's the standard format for APA, MLA, and Chicago style reference lists. For example: text-indent: -40px; padding-left: 40px; creates a clean hanging indent — the first line (usually the author's name) sticks out, while the rest of the citation is indented.
The CSS specification targets specific Unicode categories. For opening punctuation (affected by first): opening quotation marks like " ' 「 『, opening brackets ( [ {. For closing punctuation (affected by last, force-end, allow-end): periods ., commas ,, semicolons ;, colons :, closing quotes, closing brackets, and exclamation/question marks. The exact set depends on the browser's implementation.
Yes! text-indent accepts percentage values, which are calculated relative to the width of the containing block. For example, text-indent: 5% on a 600px-wide container creates a 30px indent. This is useful for responsive designs where you want the indent to scale with the layout. However, for precise typographic control, em or rem units are often preferred as they scale with the font size.
text-indent only affects the first formatted line of a block element. All subsequent lines remain at the normal edge of the content box. If you want to indent every line, you'd use padding-left instead. This is a common point of confusion — text-indent is specifically a first-line property, which makes it perfect for paragraph styling and hanging indents.
New CSS text‑spacing property for fine control over punctuation spacing. See the effect live. For advanced typography.
Compare break‑all, keep‑all, and overflow‑wrap: anywhere/break‑word. Paste long words and see how they wrap.
Test different line‑break and word‑break values on Chinese/Japanese/Korean text. See how browsers wrap. Essential for i18n.
Create vertically oriented text layouts with `writing‑mode`. See the effect and copy the complete CSS. For vertical languages.
Paste rich text and clean it to plain text. Normalize line endings and whitespace. Prepare for code or databases.
Paste lines and convert them into bulleted lists with symbols like •, ‑, or →. Markdown friendly. Quick formatting.
Apply dyslexia‑friendly fonts, spacing, and background to any text. Preview and copy the formatted version. Improve readability.
Enter terms and definitions and generate a clean `<dl>` HTML snippet. Great for glossaries and FAQs.
See how a full paragraph looks with your chosen text and background colors. Not just a ratio; the real appearance.
Format your SQL code with consistent indentation. Choose 2 or 4 spaces. No syntax validation, just neat output.
Create outlined text with the text‑stroke property. Adjust width and color. Preview and copy the CSS.
Compare width/height with block‑size/inline‑size in different writing modes. Understand intrinsic sizing. Copy best practices.
Beautify and format your CSS stylesheets instantly. Organize, minify, or prettify CSS code for better readability. Processed securely on client-side.
Paste HTML and see a collapsible tree of tags. Understand document outline and nesting. Handier than raw code.
Check English spelling and get suggestions using the browser's built-in dictionary. Highlight errors instantly. No data leaves your machine.
Type an abbreviation and its full form to get the proper `<abbr title='...'>` HTML. For accessible markup.
See the difference between clone and slice on inline boxes that break across lines. Useful for multi‑line headings.
Style underlines, overlines, and strike-throughs with colors, wavy styles, and thickness. Modern CSS text‑decoration.
Paste lines of text and automatically convert to an HTML ordered list with correct numbering and indentation.
Use named grid lines instead of column numbers. See how they simplify placement. Visual, interactive learning.
Style a drop cap using the initial‑letter property. Set size and sink. Modern alternative to pseudo‑element hacks.
Style a drop cap using the initial‑letter property. Set size and sink. Modern alternative to pseudo‑element hacks.
Paste your full CSS and HTML; automatically identify and extract the styles needed for the visible part. Reduce render‑blocking resources.
Detect browser support for font‑tech() and font‑format() values in @font‑face src. Check COLRv1, variable, etc.
Style the first letter of a paragraph as a large decorative drop cap. Choose font, color, and size. Get the CSS & HTML.
See how grid-auto-flow: row vs column changes item placement. Add and remove items to understand the algorithm. Visual.
Paste two versions of the same idea and see a word‑level diff highlighting the rewrite. Not AI, just diff.
Create cards and review using a spaced repetition algorithm (Leitner box simulation). Cards stored locally. Improve exam prep.
Apply East Asian glyph variants like jis78, proportional-width, ruby. See the difference instantly. For CJK typography.
Build a date format string for SQL by toggling components (YYYY, MM, DD). See a live example for different databases.