Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Tailwind CSS Typography

Tailwind CSS Typography

Tailwind CSS's Typography(typography) feature is a set of utilities that help developers efficiently design text styles. It includes basic typographic properties such as font family, font weight, line height, letter spacing, and text alignment, while also supporting complex typographic needs such as responsive font sizes, text shadows, text decorations, etc.

1. Font Family

Tailwind provides some utility classes to set font families (font-family), which can be easily applied through class names.

Common Utility Classes:

Example

Test text content ...

Test text content ...

Test text content ...

Try it »

2. Font Size

Font size can be controlled through Tailwind's text-* utility classes, supporting a range from text-xs to text-9xl to various sizes, and you can even customize font sizes.

Common Utility Classes:

Example

Test text content ...

Test text content ...

Test text content ...

Test text content ...

Test text content ...

Try it »

3. Font Weight

Font weight can be controlled through font-* utility classes, Tailwind provides a range from font-thin to font-black to various weight options.

Common Utility Classes:

Example

Test text content ...

Test text content ...

Test text content ...

Test text content ...

Test text content ...

Try it »

4. Line Height

Line height (i.e., line spacing) can be controlled through leading-* utility classes. Tailwind provides various line height options, from leading-none to leading-loose, which can be adjusted as needed.

Common Utility Classes:

Example

So I started to walk into the water...

So I started to walk into the water...

So I started to walk into the water...

Try it »

5. Letter Spacing

Letter spacing can be controlled through tracking-* utility classes. Common letter spacing options include tracking-tight、tracking-normal and tracking-wide, used to adjust the space between letters.

Common Utility Classes:

Example

Test text content ...

Test text content ...

Test text content ...

Try it »

6. Text Color

Tailwind provides a variety of text color classes, allowing you to set different colors for text. You can use text-* utility classes to set colors.

Common Utility Classes:

Example

Test text content...

Test text content...

Test text content...

Test text content...

Test text content...

Try it »

7. Text Alignment

Tailwind provides simple utility classes to control text alignment. You can use text-left、text-center or text-right to set the alignment of text.

Common Utility Classes:

Example

This is left-aligned text

This is center-aligned text

This is right-aligned text

Try it »

8. Text Decoration

You can use the underline, line-through and no-underline to control underlines and strikethrough on text.

Common Utility Classes:

Example

Test text content ...

Test text content ...

Test text content ...

Test text content ...

Try it »

9. Text Transform

Tailwind provides uppercase、lowercase and capitalize classes to control text capitalization.

Common Utility Classes:

Example

Test text content ...

Test text content ...

Test text content ...

Test text content ...

Try it »

10. Text Shadow

Tailwind allows you to add shadow effects to text, using text-shadow utility classes.

Common Utility Classes:

Example

This text has a shadow effect

Try it »

11. Responsive Font Size

Tailwind supports responsive design; you can set different font sizes at different screen sizes. By adding prefixes for different screen sizes such as sm:, md:, lg:, xl: , you can control the font size.

Example

This is responsive text size

Try it »