• Tutorials Logic, IN
  • +91 8092939553
  • info@tutorialslogic.com

CSS Overflow

Overflow

Sometimes, there may be a situation when the amount of content placed in an element is too longer to fit into an area. In such cases, the content of an element overflows, which may distrupt the display of the entire web page and make it unresponsive. The CSS overflow property defines whether to clip the content or to add the scrollbars when the content of an element is too longer to fit into the specified area. There are three types of overflow property available in CSS, which are given below-

  • overflow It defines the both horizontal as well as vertical scroll bar.
  • overflow-x It defines the horizontal scroll bar.
  • overflow-y It defines the vertical scroll bar.

All three overflow properties has one of the following values-

ValueDescription
visibleIt is the default value for overflow, which specifies the overflow is not clipped and the content renders outside the elements box.
hiddenIt specifies the overflow is clipped, and rest of the content of an element is invisible.
scrollIt specifies the overflow is clipped, and adds a scroll bar to see the rest of the content of an element.
autoIt is almost similar to scroll except the scrollbar, which will be shown only if the content of an element does overflow.
inheritIt inherits the overflow property value from its parent element.
initialIt sets the property value to its initial value (i.e. visible).
										    
											div {
												width: 300px;
												height: 100px;
												overflow: scroll;
											}