Open In App
Related Articles

CSS overflow-x Property

Improve Article
Save Article
Like Article

The overflow-x property in CSS specifies whether to add a scroll bar, clip the content, or display overflow content of a block-level element, when it overflows at the left and right edges. 

In other words, this property helps us to display the content which is overflowing from the page horizontally.

The default value of the overflow-x property is visible. This CSS property is not animatable.


overflow-x: visible|hidden|scroll|auto|initial|inherit;

Property Values: 

  • visible: This property does not clip the content. The content may be rendered outside the left and right edges.
  • hidden: It is used to clip the content and no scrolling mechanism is provided.
  • scroll: It is used to clip the content and provide a scrolling mechanism.
  • auto: It provides a scrolling mechanism for overflowing boxes.
  • initial: This property is used to set the overflow-x property to its default value.
  • inherit: This property is inherited from its parent.

Example: In this example, we are using the above-explained property.


<!DOCTYPE html>
        div.example1 {
            background-color: green;
            width: 80px;
            overflow-x: scroll;
        div.example2 {
            background-color: green;
            width: 80px;
            overflow-x: hidden;
        div.example3 {
            background-color: green;
            width: 80px;
            overflow-x: auto;
        div.example4 {
            background-color: green;
            width: 80px;
            overflow-x: visible;
        The overflow-x property specifies whether to
        clip the content, add a scroll bar, or display
        overflow content of a block-level element,
        when it overflows at the left and right edges.
    <h2>overflow-x: scroll:</h2>
    <div class="example1">
        GeeksforGeeks computer science portal
    <h2>overflow-x: hidden:</h2>
    <div class="example2">
        GeeksforGeeks computer science portal
    <h2>overflow-x: auto:</h2>
    <div class="example3">
        GeeksforGeeks computer science portal
    <h2>overflow-x: visible (default):</h2>
    <div class="example4">
        GeeksforGeeks computer science portal


Supported Browsers: The browsers supported by the overflow-x property are listed below: 

  • Google Chrome 1.0
  • Edge 12
  • Internet Explorer 5.0
  • Firefox 3.5
  • Safari 3.0
  • Opera 9.5

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 13 Jun, 2023
Like Article
Save Article
Similar Reads
Complete Tutorials