CSS - overflow


Description:

The overflow property determines how content which overflows its element's content area should be handled.

Possible Values:

  • visible: Overflowing content should be displayed.
  • hidden: Overflowing content should not be displayed.
  • scroll: Overflowing content should not be displayed, but the user agent should provide some means of accessing the hidden content (e.g., a set of scrollbars).
  • auto: The behavior caused by this value is dependent on the browser.

Applies to:

All the HTML elements

DOM Syntax:

object.style.overflow="scroll";

Example:

Here is the example:

<style type="text/css">
.scroll{
	display:block;
	border: 1px solid red;
	padding:5px;
	margin-top:5px;
	width:300px;
	height:50px;
	overflow:scroll;
	}
.auto{
	display:block;
	border: 1px solid red;
	padding:5px;
	margin-top:5px;
	width:300px;
	height:50px;
	overflow:auto;
	}
</style>
<p>Example of scroll value:</p>
<div class="scroll">
I am going to keep lot of content here just to show
you how scrollbars works if there is an overflow in
an element box. This provides your horizontal as well
 as vertical scrollbars.
</div>
<br />
<p>Example of auto value:</p>
<div class="auto">
I am going to keep lot of content here just to show
you how scrollbars works if there is an overflow in
an element box. This provides your horizontal as well
as vertical scrollbars.
</div>
     

This will produce following result:

Example of scroll value:

I am going to keep lot of content here just to show you how scrollbars works if there is an overflow in an element box. This provides your horizontal as well as vertical scrollbars.

Example of auto value:

I am going to keep lot of content here just to show you how scrollbars works if there is an overflow in an element box. This provides your horizontal as well as vertical scrollbars.





Spacer Bottom Left Corner ImageBottom Right Corner Image
Valid XHTML 1.0 Strict  Valid CSS! Check the accessibility of this site according to U.S. Section 508