CSS overflow-x Property


The overflow-x CSS property is used to control how content overflows in the horizontal direction within an HTML element with a specified width and height. It determines whether a horizontal scrollbar should appear when the content overflows the element's designated width. The property can take several values, including "visible" (default, where content overflows the element), "hidden" (content is clipped and no scrollbar appears), "scroll" (a scrollbar is always visible), and "auto" (a scrollbar appears only when content exceeds the element's width). overflow-x is particularly useful for managing horizontal overflow situations, such as long text strings or wide images within containers.

Initial value
Applies to
Block containers, flex containers and grid containers
Computed value
As specified
JavaScript syntax

Interactive Demo

The value of Pi is 3.1415926535897932384626433832795029. The value of e is 2.7182818284590452353602874713526625.


overflow-x: visible | hidden | scroll | auto


  • visibleContent is not clipped and scroll bars are not added. Elements are clipped to the size of the containing window or frame.
  • hiddenContent that exceeds the dimensions of the object is not shown.
  • scrollContent is clipped and scroll bars are added, even if the content does not exceed the dimensions of the object.
  • autoContent is clipped and scrolling is added only when necessary.


<div class="test"> visible
<img src="images/tech.gif" alt="">
<div class="test2"> hidden
<img src="images/tech.gif" alt="">
<div class="test3"> scroll
<img src="images/tech.gif" alt="">
<div class="test4"> auto
<img src="images/tech.gif" alt="">
div {
   display: inline-block; 
   margin-right: 30px;
   width: 100px; 
   height: 100px;
   border: 2px solid blue; 
img {
   width: 125px;
   height: 125px;
.test {
   overflow-x: visible;
   overflow-y: visible;
.test2 {
   overflow-x: hidden;
   overflow-y: hidden; 
.test3 {
   overflow-x: scroll;
   overflow-y: scroll;
.test4 {
   overflow-x: auto;
   overflow-y: auto; 

Browser Support

The following table will show you the current browser support for the CSS overflow-x property.

Edge Chrome Firefox Opera Safari
Tablets / Mobile
Chrome Firefox Opera Safari Samsung Webview

Last updated by CSSPortal on: 2nd January 2024