overflow-y
Specifies how overflowing content is displayed along the y-axis (vertical direction).
Sample Code
div.test { overflow-y: visible;}
div.test1 { overflow-y: hidden;}
div.test2 { overflow-y: scroll;}
div.test3 { overflow-y: auto;}
Available Values
| Value | Description |
|---|---|
| visible | Content overflows and is displayed. This 'visible' is the initial value. |
| hidden | The overflowing part is not displayed. |
| scroll | The overflowing part becomes scrollable. |
| auto | Leaves the display of overflowing content to the browser. In most browsers, this behaves the same as 'scroll'. |
Browser Display Result
<div style="overflow-y: visible; border: solid 1px red; width: 200px; height: 100px; margin: 0 auto;">This is a div element with a width of 200px and height of 100px (red border). The overflowing part is displayed as-is. Text text text text text text text.</div>
<div style="overflow-y: hidden; border: solid 1px red; width: 200px; height: 100px; margin: 0 auto;">This is a div element with a width of 200px and height of 100px (red border). The overflowing part is not displayed. Text text text text text text text.</div>
<div style="overflow-y: scroll; border: solid 1px red; width: 200px; height: 100px; margin: 0 auto;">This is a div element with a width of 200px and height of 100px (red border). The overflowing part becomes scrollable. Text text text text text text text.</div>
<div style="overflow-y: auto; border: solid 1px red; width: 200px; height: 100px; margin: 0 auto;">This is a div element with a width of 200px and height of 100px (red border). In most browsers, the overflowing part becomes scrollable. Text text text text text text text.</div>
Browser Compatibility
2 and earlier ×
2 and earlier ×
8 ○
7 ○
6 ○
8 and earlier ×
Android Browser
4.4+ ○
3 and earlier ×Details
Specifies how overflowing content is displayed along the y-axis (vertical direction).
In most browsers, there is no visual difference between specifying 'auto' and 'scroll'.
The 'overflow-y' property was originally added as an IE-proprietary property, but it can now be used in virtually all browsers. However, since it originated as an IE-specific feature, thorough cross-browser testing is recommended.
If you find any errors or copyright issues, please contact us.