Tailwind CSS Typography plugin (commonly referred to as @tailwindcss/typography) provides a set of predefined styles that simplify and standardize the typography of HTML content such as blog posts and documentation. These predefined styles are primarily applied through a class called prose, and include various adjustable options to accommodate different design requirements.
Here are some main style options that can be adjusted using class modifiers:
-
Size
prose-sm: Smaller text size.prose-lg: Larger text size.prose-xl: More prominent text size, suitable for large headings or important content.prose-2xl: Text size significantly enlarged.
-
Color
prose-blue: Text and links use a blue theme.prose-green: Text and links use a green theme.- Additional colors such as
prose-red,prose-yellow, etc., can be set for different color themes based on requirements.
-
Dark Mode
prose-dark: Color inversion for dark mode.
When using it, you can easily apply these classes to HTML elements containing text, as shown in the following example:
html<article class="prose prose-lg prose-blue"> <h1>Article Title</h1> <p>This is a paragraph of the article, using larger font size and blue theme.</p> </article>
In this example, prose enables the basic typography styles, prose-lg increases the text size, and prose-blue sets a blue theme for the text and links. This combination enhances the visual appeal of the article while maintaining a good reading experience.