×

CSS Overflow

CSS Overflow: The Overflow property in CSS is used to manage the content if it overflows from its container of the block level. We have seen that all the elements are placed in the form of a rectangular box, whereas these box’s behavior, positioning, and size can be controlled and created by using the CSS.

For example: - If we don’t mention the height and width of a particular box, it will set as vast as any content. Although, if we specify the width and height of a box specifically and any content inside will not be adjusted then what should do. The Overflow Property can be applied to solve this problem. The Overflow Property portrays whether we have to clip the content, show the content on the screen, and render the scroll bars.

Note: The CSS overflow property implements only for the block elements along with the particular height.

Property Values

ValuesDescription
visibleA visible value says that the overflow content is not cropped or clipped. It delivers outer side box of an element. A visible is a type of default value.
hiddenThe overflow content is clipped; the other content is invisible.
scrollThe overflow content is clipped, although a scroll-bar will be added to explore the other content.
autoThe overflow content is clipped, although a scroll-bar will be added to examine the other content.
inheritIt acquires the properties from the parent element.
initialIt sets the properties of CSS to their default value.

Overflow Example

Take a look on the following example:

<!DOCTYPE html>
<html>
<head>
<style>
div.scroll
{
 background-color: lightblue;
 width: 100px;
 height: 100px;
 overflow: scroll;
}
div.hidden
{
 background-color: lime;
 width: 100px;
 height: 170px;
 overflow: hidden;
}
div.visible
{
 background-color: pink;
 width: 100px;
 height: 170px;
 overflow: visible;
}
div.auto
{
 background-color: yellow;
 width: 100px;
 height: 170px;
 overflow: auto;
}
</style>
</head>
<body>
<p> The CSS overflow property defines that what should do when an element's content grow-up to the element box's size. </p>
<h3> Overflow: scroll </h3>
<div class= "scroll"> We can apply the CSS Overflow Property if we wish to gain better layout control.
Default value will be visible. </div>
<h3> Overflow: hidden </h3>
<div class= "hidden"> We can apply the CSS Overflow Property if we wish to gain better layout control.
Default value will be visible. </div>
<h3> Overflow: visible </h3>
<div class= "visible"> We can apply the CSS Overflow Property if we wish to gain better layout control.
Default value will be visible. </div>
<h3> Overflow: auto </h3>
<div class= "auto"> We can apply the CSS Overflow Property if we wish to gain better control on the layout.
Default value will be visible. </div>
</body>
</html>

Output:

CSS Overflow

Related Topics

CSS Text-stroke

Text-stroke Text-stroke CSS property inserts the stroke to any text and gives a decoration option to them also. It describes the stroke’s width and color for various text characters. It is...

2 minutes read.

CSS Units

CSS Units In CSS, there are so many units available to show the length’s measurement. A single unit of CSS is applied to examine the size of the property, which the...

5 minutes read.

CSS Text-decoration

CSS Text-decoration: It is an essential property of CSS that is used to decorate the content of the text. It can add-on the lines above, under, and over the text....

3 minutes read.

How to create blinking text using CSS

The blinking effect is used in HTML and CSS to take the attraction towards a particular word or section. If you need such a blinking effect, we need to take...

2 minutes read.

How To Use CSS

You can use CSS(Cascading Style Sheet) in four ways. These are given below: The given above CSS type, in which various technique will be used. These are different from each other and...

2 minutes read.

CSS Selector

CSS Selector: There are some selectors used in CSS, which allows us to choose the content we wish to style. Various selectors are considered as the separation of the set...

5 minutes read.

CSS Images

Images in CSS: Images are a critical part of a web application. It includes various types of images in the web application that cannot be recommended. However, it is essential...

4 minutes read.

CSS Pseudo-class

Pseudo-class The pseudo-class may be depicted as the keyword which can be mixed to any selector that specifies the elected element’s unique state. It can be included to a selector to...

6 minutes read.

CSS Line Height

CSS Line Height: This property in CSS can be used to describe the line box’s minimal height inside the element. It sets-up the distinction among two lines in our content. It...

3 minutes read.

CSS :root selector

CSS :root selector This CSS pseudo-class matches any document’s root element. It chooses the parent of the highest-level inside the document DOM or tree. An element of <html> is always a...

2 minutes read.

Combine Background Image with Gradient Overlay

With the help of CSS gradient, we can display smooth and straightforward transitions between two or more colours. We can add the background images by combining the gradient property with...

2 minutes read.

CSS Box-shadow

CSS Box-shadow This property is referred to include effects as shadow-like around an element’s frame. Syntax box-shadow: h-offset v-offset blur spread color |inset|inherit|none; Property values Following are the various property values which can be used...

3 minutes read.

CSS Variables

CSS Variables These variables of CSS are applied to add the custom property values to our various web-pages. The custom properties are often called as CSS variables or cascading variables. Various...

4 minutes read.

CSS Width

CSS Width The width property in CSS sets the content width of area of the element. These properties do not provide margin and border features. It is used to set the...

1 minute read.

CSS Lists

CSS Lists: Several properties are available in CSS that are used to manage the lists. Lists are distributed as ordered and unordered kind of lists. The ordered lists provide the...

7 minutes read.

How to use google fonts in CSS

Fonts: - Fonts are used to make our website look more beautiful. Choosing appropriate font according to the web design or layout is also important. Many typefaces are accessible in...

4 minutes read.

Difference between CSS Grid and CSS Flexbox

The way that information is arranged on a website reveals a lot about you or your company. Organizational abilities are just as important as having the right materials. The design...

3 minutes read.

CSS Order

CSS Order CSS order property in CSS describes the flex item’s order inside the flex or any grid container. It is applied to order any flex item. Note: If any component is...

3 minutes read.

Untitled Reusable Block

  ...

1 minute read.

CSS Font

CSS Font: CSS has font property, which makes the text more attractive. We can alter the entire look by changing font color, font size, font style, and much more. In...

5 minutes read.