Overflow
The overflow class sets the overflow property. It controls how content is handled when it does not fit in its container and overflows.
| CSS Shortcut class | Applied style |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Examples
Visible
overflow-visible
Content that doesn’t fit in this element overflows horizontally and vertically.
<div class="overflow-visible">
Content that doesn’t fit in this element overflows horizontally and vertically.
</div>
Visible horizontal (x)
overflow-x-visible
Content that doesn’t fit in this element overflows horizontally.
<div class="overflow-x-visible" style="width: 250px;">
<p style="width: 500px;">
Content that doesn’t fit in this element overflows horizontally.
</p>
</div>
Visible vertical (y)
overflow-y-visible
Content that doesn’t fit in this element overflows vertically.
<div class="overflow-y-visible">
Content that doesn’t fit in this element overflows vertically.
</div>
Hidden
overflow-hidden
Content that doesn’t fit in this element is invisible, but still exists for screenreaders.
<p class="overflow-hidden">
Content that doesn’t fit in this element is invisible, but still exists for screenreaders.
</p>
Hidden horizontal (x)
overflow-x-hidden
Content that doesn’t fit to the left and right of this element is invisible, but still exists for screenreaders.
<div class="overflow-x-hidden" style="width: 250px;">
<p style="width: 500px;">
Content that doesn’t fit to the left and right of this element is invisible, but still exists for screenreaders.
</p>
</div>
Hidden vertical (y)
overflow-y-hidden
Content that doesn’t fit above or below this element is invisible, but still exists for screenreaders.
<p class="overflow-y-hidden">
Content that doesn’t fit above or below this element is invisible, but still exists for screenreaders.
</p>
Scroll
overflow-scroll
Content that doesn’t fit in this element can be scrolled to with vertical and horizontal scrollbars.
<a href="#" class="overflow-scroll">
Content that doesn’t fit in this element can be scrolled to with vertical and horizontal scrollbars.
</a>
Scroll horizontal (x)
overflow-x-scroll
<a href="#" class="overflow-x-scroll" style="width: 250px;">
<p style="width: 500px;">
Content that doesn’t fit in this element can be scrolled to with a horizontal scrollbar.
</p>
</a>
Scroll vertical (y)
overflow-y-scroll
<a href="#" class="overflow-y-scroll">
Content that doesn’t fit in this element can be scrolled to with a vertical scrollbar.
</a>
xs:> 480pxsm:> 640pxmd:> 768pxlg:> 1024pxxl:> 1280px
<div class="xs:overflow-hidden ...">
...
</div>