text‑indent & hanging‑punctuation Demo - Online
Set up first‑line indentation and hanging punctuation. See how they affect reading flow. Copy the CSS.
UD5 Toolkit
Interactive preview of text-spacing — trim-start, space-first, ideograph-alpha & more for CJK typography.
text-spacing: normal;
The dashed red line marks the container's left edge — observe how leading punctuation aligns.
text-spacing property?
text-spacing is a CSS property defined in CSS Text Module Level 4 that controls spacing around punctuation and between ideographic (CJK) characters and other character types. It's especially useful for Chinese, Japanese, and Korean typography, where fullwidth punctuation marks often have built-in whitespace that may need trimming or adjusting for polished layouts.
Key values include trim-start (removes leading space from fullwidth punctuation at line start), space-first (preserves that space), ideograph-alpha (adds ¼em gap between CJK and Latin letters), and ideograph-numeric (same for digits).
trim-start and space-first?
trim-start: Removes the leading whitespace of fullwidth punctuation marks (like 「, (, 《) when they appear at the start of a block or line. This makes the text visually flush with the container's left edge.
space-first: Preserves that whitespace, keeping the punctuation's natural fullwidth spacing intact. The text will appear slightly indented if the first character is a fullwidth punctuation mark.
In traditional Chinese print typography, space-first is often the default, while trim-start is preferred in modern web layouts for cleaner alignment. The visual difference is subtle but meaningful for professional typesetting.
ideograph-alpha improve readability?
ideograph-alpha automatically inserts a ¼em space between CJK ideographs (hanzi, kanji, hangul) and adjacent Latin letters. Without this spacing, mixed-language text like "使用CSS进行排版" can look cramped, with Chinese characters and English letters touching each other.
With ideograph-alpha enabled, the same text displays as "使用 CSS 进行排版" (with subtle spacing), significantly improving legibility in multilingual content. This is especially valuable for technical documentation, UI labels, and internationalized websites.
text-spacing?
As of 2024–2025:
trim-start and space-first may not workFor production use, always provide a fallback and test across target browsers. The property is part of the Interop 2024 initiative, so cross-browser support is rapidly improving.
text-spacing values?
Yes! You can combine values by separating them with spaces. Common practical combinations include:
text-spacing: trim-start ideograph-alpha; — trim leading punctuation + add CJK-Latin spacingtext-spacing: trim-start ideograph-alpha ideograph-numeric; — all three enhancementstext-spacing: normal ideograph-alpha; — default behavior plus CJK-Latin spacingThe order of values doesn't matter; the browser applies all specified features. Use no-autospace to explicitly disable ideograph-alpha and ideograph-numeric if they're being inherited or defaulted.
text-spacing affect SEO?
Indirectly, yes. While text-spacing doesn't directly influence search engine rankings, it improves readability and user experience for CJK audiences — which are positive UX signals. Better readability leads to lower bounce rates and higher engagement, both of which can positively impact SEO.
For multilingual websites targeting Chinese, Japanese, or Korean users, proper text-spacing demonstrates attention to locale-specific typography, enhancing credibility and user trust.
trim-end and allow-end?
trim-end: Removes trailing whitespace from fullwidth punctuation at the end of a line or block — similar to trim-start but for the right/end side.
allow-end: Permits punctuation at line-end to hang outside the containing block (similar to hanging-punctuation). This is useful for justified text where a punctuation mark at line-end would otherwise push text to the next line.
Both affect line-end behavior, but allow-end is specifically about allowing punctuation to extend beyond the text block boundary for smoother line wrapping.
Set up first‑line indentation and hanging punctuation. See how they affect reading flow. Copy the CSS.
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.
Beautify and format your CSS stylesheets instantly. Organize, minify, or prettify CSS code for better readability. Processed securely on client-side.
Create vertically oriented text layouts with `writing‑mode`. See the effect and copy the complete CSS. For vertical languages.
Style the first letter of a paragraph as a large decorative drop cap. Choose font, color, and size. Get the CSS & HTML.
Test different line‑break and word‑break values on Chinese/Japanese/Korean text. See how browsers wrap. Essential for i18n.
Paste your full CSS and HTML; automatically identify and extract the styles needed for the visible part. Reduce render‑blocking resources.
Create outlined text with the text‑stroke property. Adjust width and color. Preview and copy the CSS.
Paste rich text and clean it to plain text. Normalize line endings and whitespace. Prepare for code or databases.
Use named grid lines instead of column numbers. See how they simplify placement. Visual, interactive learning.
Compare break‑all, keep‑all, and overflow‑wrap: anywhere/break‑word. Paste long words and see how they wrap.
Style underlines, overlines, and strike-throughs with colors, wavy styles, and thickness. Modern CSS text‑decoration.
Apply East Asian glyph variants like jis78, proportional-width, ruby. See the difference instantly. For CJK typography.
Compare width/height with block‑size/inline‑size in different writing modes. Understand intrinsic sizing. Copy best practices.
See the difference between clone and slice on inline boxes that break across lines. Useful for multi‑line headings.
Detect browser support for font‑tech() and font‑format() values in @font‑face src. Check COLRv1, variable, etc.
Build a complete font‑stack for your website. Choose a primary font and get the best fallback options for different OS. Copy the CSS.
See how grid-auto-flow: row vs column changes item placement. Add and remove items to understand the algorithm. Visual.
Create glowing, neon‑style text effects with multiple text‑shadows. Adjust colors and intensity. Copy the CSS.
Toggle scroll‑behavior: smooth and click anchor links to see the scrolling animation. Implement modern UX.
Apply the drop‑shadow() filter and compare it with box‑shadow. See how it follows the contour of transparent images. Copy code.
Paste HTML and see a collapsible tree of tags. Understand document outline and nesting. Handier than raw code.
Replace long CSS class names with short random strings. Map generated. For production optimization.
Toggle between light and dark mode for a demo page. See how to use the media query. Copy the pattern.
Choose tabular‑nums, diagonal‑fractions, ordinal and see the effect on a numeric list. Elegant data presentation.
See the difference between :focus and :focus‑visible on interactive elements. Learn which to use for better UX.
Toggle scrollbar‑gutter: stable to reserve space for the scrollbar and avoid content jumps. Visual demo with two columns.
Paste your CSS and strip all `!important` declarations in one click. See a list of affected rules. Local tool.
Resize the container and see the difference between repeat(auto‑fill, …) and auto‑fit. Understand responsive grid behavior.