iEntry 10th Anniversary CSS Snippets JavaScript Snippets

 
 





Overflow Attribute

The overflow attribute in CSS will allow you to create a scrollable area inside your website. This will allow you to control the look of your site, even if the content that you are placing on the site seems like it will now allow that content.

<style>
.flowover {
	overflow: auto;
	height: 100px;
	width: 100px; 
}
<style>
< !-- Additional code //-->
<div class="flowover">Here is the content that should overflow in the div HTML element.  If there is enough text, then there will be a scroll bar that will appear.</div>
< !-- Additional code //-->

We created a simple class called overflow. With this class we set the size of the element's height and width, and the overflow attribute to auto. The overflow attribute can be set to one of the following values, Below is examples of each value that can be applied to the overflow attribute. There is a border around each div tag in the example to show the element's size.

Hidden:

This value will hide the scroll bar if the content of the element overflows. It will also not show any content that has overflowed.

Here is the content that should overflow in the div HTML element. If there is enough text, then there will be a scroll bar that will not appear. Even it that means that some of the content does not show up on the page. The user will never see this content, unless they look at the source code.

Scroll:

The scroll content will allow the overflowed content to be seen with the use of a scroll bar. If the content does not overflow, then the scroll bars are still shown.

Here is the content that should overflow in the div HTML element. If there is not enough text, then there will be a scroll bar that will appear.

Auto:

Auto will show the content similar to scroll. The only difference is if the content does not overflow, then it will not show the scroll bars. This allows for a cleaner looking site.

Here is the content that should overflow in the div HTML element. If there is enough text, then there will be a scroll bar that will appear. If we do not have enough content to fill up the element, then the scroll bars do not show up.

Visible:

This is the default value, and if the content does overflow the content is rendered outside of the element.

Here is the content that should overflow in the div HTML element. If the content does overflow, the content will be displayed out side of the element's area. Since the content just flows outside of the element, then there will not be any scroll bars that will be visiable.