Last updated: 13 May 2024

Tailwind CSS Overflow

The overflow utility class in Tailwind CSS allows you to control how content that overflows its container is displayed.


Tailwind Overflow

The overflow utility class in Tailwind CSS allows you to control how content that overflows its container is displayed. With Tailwind's overflow class, you can specify whether to show or hide the overflowing content, and how it should be scrolled if necessary.

Applying Overflow

To apply the overflow behavior to an element, you can use the overflow-{value} utility class, where {value} represents the desired overflow behavior. Here are the available options:

  • overflow-auto: Automatically shows scrollbars when needed, and hides them when not needed.
  • overflow-hidden: Hides any content that overflows the container.
  • overflow-visible: Displays the overflowing content without any clipping.
  • overflow-scroll: Always shows scrollbars, even if the content doesn't overflow.
  • overflow-x-auto: Applies auto overflow on the horizontal axis only.
  • overflow-y-auto: Applies auto overflow on the vertical axis only.
html
<div class="overflow-y-scroll">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Assumenda, quia temporibus eveniet a
libero incidunt suscipit.
</div>

Preview

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Assumenda, quia temporibus eveniet a libero incidunt suscipit.

Responsive Overflow

Tailwind CSS allows you to apply overflow classes responsively at different breakpoints. To use responsive overflow classes, you can append the breakpoint prefix to the utility class. For example, md:overflow-hidden hides overflowing content starting from the medium breakpoint and above.

html
<div class="overflow-auto md:overflow-hidden">
<!-- Content that may overflow -->
</div>

In the above example, the overflow behavior is set to auto by default (overflow-auto), but starting from the medium breakpoint and above, the overflow behavior is changed to hidden (md:overflow-hidden).

Tailwind Overflow Class Table

ClassProperties
overflow-auto overflow: auto;
overflow-hiddenoverflow: hidden;
overflow-visible overflow: visible;
overflow-scrolloverflow: scroll;
overflow-x-auto overflow-x: auto;
overflow-y-auto overflow-y: auto;
overflow-x-hiddenoverflow-x: hidden;
overflow-y-hiddenoverflow-y: hidden;
overflow-x-visibleoverflow-x: visible;
overflow-y-visibleoverflow-y: visible;
overflow-x-scrolloverflow-x: scroll;
overflow-y-scrolloverflow-y: scroll;

Windframe Tailwind blocks

Pricing

Windframe is a drag and drop builder for rapidly building tailwind css websites and UIs

Start building stunning tailwind UIs! 

Build from scratch or select prebuilt tailwind templates