Class reference

Style & Decoration - 图1

Italics

Use the .italic utility to make text italic.

Style & Decoration - 图2

Use the .roman utility to display text normally. This is typically used to reset italic text at different breakpoints.

Style & Decoration - 图3

Capitalization

Use the .uppercase utility to uppercase text.

Style & Decoration - 图4

Use the .lowercase utility to lowercase text.

Style & Decoration - 图5

Use the .capitalize utility to capitalize text.

Style & Decoration - 图6

Use the .normal-case utility to preserve the original casing. This is typically used to reset capitalization at different breakpoints.

Style & Decoration - 图7

Underlines

Use the .underline utility to underline text.

Style & Decoration - 图8

Use the .line-through utility to strike out text.

Style & Decoration - 图9

Use the .no-underline utility to remove underline or line-through styling.

Style & Decoration - 图10

Antialiasing

Use the .antialiased utility to render text using grayscale antialiasing.

Style & Decoration - 图11

Use the .subpixel-antialiased utility to render text using subpixel antialiasing.

Style & Decoration - 图12

Responsive

To control the style and decoration of an element at a specific breakpoint, add a {screen}: prefix to any existing style and decoration utility. For example, use md:underline to apply the underline utility at only medium screen sizes and above.

For more information about Tailwind’s responsive design features, check out the Responsive Design documentation.

Style & Decoration - 图13

all

Style & Decoration - 图14

sm

Style & Decoration - 图15

md

Style & Decoration - 图16

lg

Style & Decoration - 图17

xl

Style & Decoration - 图18

Hover

To control the style and decoration of an element on hover, add the hover: prefix to any existing style and decoration utility. For example, use hover:underline to apply the underline utility on hover.

Style & Decoration - 图19

Hover utilities can also be combined with responsive utilities by adding the responsive {screen}: prefix before the hover: prefix.

  1. <a href="#" class="... md:no-underline md:hover:underline ...">Link</a>

Focus

To control the style and decoration of an element on focus, add the focus: prefix to any existing style and decoration utility. For example, use focus:uppercase to apply the uppercase utility on focus.

Style & Decoration - 图20

Focus utilities can also be combined with responsive utilities by adding the responsive {screen}: prefix before the focus: prefix.

  1. <input class="md:focus:uppercase ..." value="Focus me">

Customizing

Responsive and State Variants

By default, only responsive, hover and focus variants are generated for text style utilities.

You can control which variants are generated for the text style utilities by modifying the textStyle property in the modules section of your Tailwind config file.

For example, this config will also generate variants:

Style & Decoration - 图21

Disabling

If you don’t plan to use the text style utilities in your project, you can disable them entirely by setting the textStyle property to false in the modules section of your config file:

Style & Decoration - 图22