English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

CSS Reference Manual

CSS @rules (RULES)

Complete List of CSS Properties

CSS3 overflow-Usage and examples of the property

overflow-The CSS property specifies how content overflowing the top and bottom edges of the element's content area is clipped, displayed as a scrollbar, or shown as overflow content.

下表为此属性的用法说明和版本历史记录,以及该属性在javascript脚本中的使用语法。

The following table provides usage instructions and version history for this property, as well as the usage syntax of this property in JavaScript scripts.visible
Default value:Applies to:-Block, inline
block and flex containersInheritance:
NoCan be animated:No. Please see.
Animation properties CSS3version
New feature ofobject.style.overflowY="scroll"

y-Using syntax

The syntax of this property is as follows:

overflow-y: visible | hidden | scroll | auto | initial | inherit

The following examples demonstrate how to use overflow-y property.

  div {
   width: 400px;
   height: 300px;
   overflow-x: scroll;
  }
Test to see‹/›

Property value

The following table describes the values of this property.

ValueDescription
visibleThe content is not clipped; it is rendered outside the element's box, so it may overlap with other content. This is the default value.
hiddenThe content within the overflow element's box will be clipped, and the remaining content will be invisible.
scrollThe overflow content is clipped as if hidden, but provides a scrolling mechanism to access the overflowed content.
autoIf the content overflows the element's box, it will provide a scrollbar to view the remaining content.
initialSet this property to its default value.
inheritIf specified, the associated elements will use their parent element's overflow-y property values.

Browser compatibility

overflow-y property browser compatibility, the numbers in the following table indicate the minimum version number of the browser that supports this property; all mainstream browsers support this property.

  • Firefox 1.5Above

  • Google Chrome1+

  • Internet Explorer 9+

  • Apple Safari 3+

  • Opera 9.5+

Warning: Internet Explorer 7and earlier versions do not support this overflow-y property. IE8supports this property, but requires Microsoft-specific-ms-prefix (e.g.-ms-overflow-y). In IE9and higher versions are supported.

For further reading

Please refer to the following tutorials:CSS Overflow.

Related properties:overflow,overflow-x,clip,word-wrap.