overflow-x
Anonymous contributor
Published Jul 9, 2021Updated Mar 10, 2024
Contribute to Docs
Defines how a block level element should handle content that goes beyond its x-axis boundary.
Syntax
overflow-x: <value>;
where <value>
can be one of the following:
visible
: the default value. No content will be clipped and a scrollbar will not appear.hidden
: content will be clipped and no scrollbar will appear.scroll
: content will be clipped and a scrollbar will appear.auto
: content will be clipped if it does not fit in the containing block, and a scrollbar will appear if it does.- Keyword values:
initial
,inherit
,revert
,unset
.
Example 1
Clip any content that overflows without providing a scrollbar to view overflow content.
.view-box {overflow-x: hidden;}
Example 2
Provide a scrollbar and clip any content that overflows.
.view-box {overflow-x: scroll;}
Example 3
Any overflowing content will be visible outside its container.
.view-box {overflow-x: visible;}
The following image demonstrates each of the overflow-x
properties described above:
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn CSS on Codecademy
- Career path
Front-End Engineer
Front-end engineers work closely with designers to make websites beautiful, functional, and fast.Includes 34 CoursesWith Professional CertificationBeginner Friendly115 hours - Career path
Full-Stack Engineer
A full-stack engineer can get a project done from start to finish, back-end to front-end.Includes 51 CoursesWith Professional CertificationBeginner Friendly150 hours - Free course
Learn CSS
In this CSS tutorial, you’ll learn how to add CSS to visually transform HTML into eye-catching sites.Beginner Friendly6 hours