Class reference

Overflow - 图1

Visible Default

Use .overflow-visible to prevent content within an element from being clipped. Note that any content that overflows the bounds of the element will then be visible.

Overflow - 图2

Auto

Use .overflow-auto to add scrollbars to an element in the event that its content overflows the bounds of that element. Unlike .overflow-scroll, which always show scrollbars, this utility will only show them if scrolling is necessary.

Overflow - 图3

Hidden

Use .overflow-hidden to clip any content within an element that overflows the bounds of that element.

Overflow - 图4

Scroll horizontally if needed

Use .overflow-x-auto to allow horizontal scrolling if needed.

Overflow - 图5

Scroll vertically if needed

Use .overflow-y-auto to allow vertical scrolling if needed.

Overflow - 图6

Scroll horizontally always

Use .overflow-x-scroll to allow horizontal scrolling and always show scrollbars unless always-visible scrollbars are disabled by the operating system.

Overflow - 图7

Scroll vertically always

Use .overflow-y-scroll to allow vertical scrolling and always show scrollbars unless always-visible scrollbars are disabled by the operating system.

Overflow - 图8

Scroll in all directions

Use .overflow-scroll to add scrollbars to an element. Unlike .overflow-auto, which only shows scrollbars if they are necessary, this utility always shows them. Note that some operating systems (like macOS) hide unnecessary scrollbars regardless of this setting.

Overflow - 图9

Momentum-based scrolling on touch devices

Use .scrolling-touch to use momentum-based scrolling (where supported) on touch devices.

Overflow - 图10

Use .scrolling-auto to use normal non-momentum-based scrolling on touch devices.

This is mostly useful for undoing .scrolling-touch at larger screen sizes.

Overflow - 图11

Responsive

To apply an overflow utility only at a specific breakpoint, add a {screen}: prefix to the existing class name. For example, adding the class md:overflow-scroll to an element would apply the overflow-scroll utility at medium screen sizes and above.

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

Overflow - 图12

all

Overflow - 图13

sm

Overflow - 图14

md

Overflow - 图15

lg

Overflow - 图16

xl

Overflow - 图17

Customizing

Responsive and State Variants

By default, only responsive variants are generated for overflow utilities.

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

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

Overflow - 图18

Disabling

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

Overflow - 图19