Class reference

Align Self - 图1

Auto Default

Use .self-auto to align an item based on the value of the flex container’s align-items property:

Align Self - 图2

Start

Use .self-start to align an item to the start of the flex container’s cross axis, despite the container’s align-items value:

Align Self - 图3

Center

Use .self-center to align an item along the center of the flex container’s cross axis, despite the container’s align-items value:

Align Self - 图4

End

Use .self-end to align an item to the end of the flex container’s cross axis, despite the container’s align-items value:

Align Self - 图5

Stretch

Use .self-stretch to stretch an item to fill the flex container’s cross axis, despite the container’s align-items value:

Align Self - 图6

Responsive

To control the alignment of a flex item at a specific breakpoint, add a {screen}: prefix to any existing utility class. For example, use md:self-end to apply the self-end utility at only medium screen sizes and above.

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

Align Self - 图7

all

Align Self - 图8

sm

Align Self - 图9

md

Align Self - 图10

lg

Align Self - 图11

xl

Align Self - 图12

Customizing

Responsive and State Variants

By default, only responsive variants are generated for align-self utilities.

You can control which variants are generated for the align-self utilities by modifying the flexbox property in the modules section of your Tailwind config file.

For example, this config will also generate hover and focus variants:

Align Self - 图13

Note that modifying the flexbox property will affect which variants are generated for all Flexbox utilities, not just the align-self utilities.

Disabling

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

Align Self - 图14

Note that modifying the flexbox property will affect which variants are generated for all Flexbox utilities, not just the align-self utilities.