Tailwind Typography is the official typography plugin for Tailwind CSS, designed to provide a set of attractive default typographic styles for HTML content that developers cannot directly control (for example, HTML rendered from Markdown or content pulled from a CMS). By using the prose classes provided by the plugin, you can quickly apply reasonable typography rules such as fonts, spacing, and heading hierarchy to raw HTML without manually writing a large amount of CSS.
Main capabilities include:
- Provides the prose base class to add default typographic styles to content areas.
- Includes five built-in gray theme modifiers that can be combined with the prose class to match the content's grayscale to the project's overall style.
- Provides five font size modifiers to adjust the overall typography size, and supports combining them with breakpoint modifiers for responsive font sizes.
- Each default color theme includes a hand-designed dark mode version, enabled via the prose-invert class.
- Supports element modifiers to customize the style of individual elements (such as links, images, etc.) directly in HTML.
- Allows overriding the built-in maximum width limit via max-w-none.
- Provides the not-prose class to isolate markup blocks that should not inherit prose styles.
- Supports custom color themes and raw CSS via the @utility directive or JavaScript configuration.
- Supports changing the default prose class name via the className option.
Usage:
- Install the plugin from npm.
- Add the plugin in the main style.css file (Tailwind CSS v4 approach), or configure it in tailwind.config.js (Tailwind CSS v3 approach).
- Add the prose class to the HTML container where typographic styles should be applied, and optionally combine it with modifiers such as grayscale, font size, and dark mode.
Use cases: Suitable for projects that need to quickly add consistent and attractive typographic styles to Markdown-rendered content, CMS output content, or other third-party HTML fragments, and is especially suitable for websites and applications using Tailwind CSS.
Limitations:
- Nesting new prose instances inside not-prose blocks is currently not supported.
- When using a utility class prefix, the not-prose class should not be prefixed.
- Custom themes and CSS need tofollow the configuration approach provided by the plugin.
- For specific installation commands and code examples, please refer to the official documentation.