The New CSS

Typography Extended

Extended typography utilities beyond the core library. Adds display-sized text (5xl through 9xl), gradient text effects, a prose class for auto-styling rich content, and text-pretty for improved line breaking.

Installation

Install the addon via npm or load it from a CDN. Requires the core library.

npm install @thenewcss/typography-extended

Design Tokens

Custom properties added to :root for extended font sizes.

TokenValue
--text-5xl3rem
--text-6xl3.75rem
--text-7xl4.5rem
--text-8xl6rem
--text-9xl8rem

Size Utilities

Display-sized text classes for hero sections, landing pages, and large headings.

ClassProperties
.text-5xlfont-size: 3rem; line-height: 1
.text-6xlfont-size: 3.75rem; line-height: 1
.text-7xlfont-size: 4.5rem; line-height: 1
.text-8xlfont-size: 6rem; line-height: 1
.text-9xlfont-size: 8rem; line-height: 1

Example: Display sizes

text-5xl

text-6xl

text-7xl

text-8xl

text-9xl

<p class="text-5xl font-bold">text-5xl</p> <p class="text-6xl font-bold">text-6xl</p> <p class="text-7xl font-bold">text-7xl</p> <p class="text-8xl font-bold">text-8xl</p> <p class="text-9xl font-bold">text-9xl</p>

Gradient Text

The .text-gradient class applies background-clip text with a transparent text fill. Combine it with a CSS gradient background to create colorful text effects.

ClassProperties
.text-gradientbackground-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent

Example: Gradient text

Gradient Text
<span class="text-gradient text-5xl font-bold" style="background: linear-gradient(135deg, var(--color-blue-500), var(--color-purple-500))"> Gradient Text </span>

Prose

The .prose class auto-styles rich text content. Wrap any block of HTML content and it receives sensible typographic defaults -- headings, paragraphs, lists, blockquotes, code blocks, tables, and more are all styled automatically.

ClassProperties
.prosemax-width: 65ch; color: gray-800; line-height: 1.75

Prose child element styles

ElementStyles
h1font-size: 2.25em, font-weight: 800, letter-spacing: -0.025em
h2font-size: 1.5em, font-weight: 700, margin-top: 2em
h3font-size: 1.25em, font-weight: 600
h4, h5font-weight: 600
h6font-size: 0.875em, color: gray-600
pmargin: 1.25em 0
acolor: blue-600, underlined, font-weight: 500
ullist-style: disc
ollist-style: decimal
codecolor: gray-900, background: gray-100, border-radius
prebackground: gray-900 (dark), border-radius, overflow-x: auto
blockquotefont-style: italic, border-left: gray-300
hrborder-color: gray-200, margin: 3em 0
tableauto-styled with borders

Example: Prose content

The Art of Typography

Why Typography Matters

Good typography makes content readable and inviting. The prose class handles all the spacing, sizing, and styling so you can focus on writing great content.

  • Automatic heading sizes and weights
  • Consistent paragraph spacing
  • Styled lists, blockquotes, and code blocks

Typography is the craft of endowing human language with a durable visual form.

Inline code is styled automatically. Links like this example link get the right color and decoration.

<div class="prose"> <h1>The Art of Typography</h1> <h2>Why Typography Matters</h2> <p>Good typography makes content readable...</p> <ul> <li>Automatic heading sizes and weights</li> <li>Consistent paragraph spacing</li> <li>Styled lists, blockquotes, and code blocks</li> </ul> <blockquote> <p>Typography is the craft of endowing human language...</p> </blockquote> <p>Inline <code>code</code> is styled automatically.</p> </div>

Text Pretty

The .text-pretty class applies text-wrap: pretty for improved line breaking. It prevents orphans and creates more balanced text blocks.

ClassProperties
.text-prettytext-wrap: pretty

Example: Text pretty

This paragraph uses text-pretty for improved line breaking. The browser will try to balance lines and avoid leaving single words on the last line, creating a more visually pleasing text block.

<p class="text-pretty max-w-md"> This paragraph uses text-pretty for improved line breaking. The browser will try to balance lines and avoid orphans. </p>

Full Class Reference

All classes included in the typography-extended addon.

ClassProperties
.text-5xlfont-size: 3rem; line-height: 1
.text-6xlfont-size: 3.75rem; line-height: 1
.text-7xlfont-size: 4.5rem; line-height: 1
.text-8xlfont-size: 6rem; line-height: 1
.text-9xlfont-size: 8rem; line-height: 1
.text-gradientbackground-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent
.prosemax-width: 65ch; color: gray-800; line-height: 1.75; auto-styles child elements
.text-prettytext-wrap: pretty