×

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 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 Outline

CSS Outline: This CSS property is quite similar to the border property of CSS. It eases us to design an additional border around the element to obtain visual attention. The...

4 minutes read.

CSS Navigation bar

CSS Navigation bar: A navigation system or navigation bar comes upon GUI that can help many visitors to access the information. A Navigation bar is a UI component on the...

11 minutes read.

Hover condition for a:before and a:after in CSS

In CSS, :after and :before are used to add content after and before the element. The CSS pseudo-class is used to add some styling effect to the webpage. We can change...

4 minutes read.

CSS Sticky

CSS Sticky The position property in CSS is applied to set an element’s position. This property is also applied to position an element behind the other element. It is useful for...

1 minute read.

CSS Page-break-inside Attribute

Page-break-inside Attribute As its name implies, the page-break-before property is applied to include page break inside any element, at the time of printing any document. It adds the page break before...

3 minutes read.

How to make smooth bounce animation using CSS

The smooth bouncing animation project is done with the help of HTML and CSS. This project gives so much fun and excitement to the users. What is HTML? The HTML or HyperText...

2 minutes read.

CSS Font-Size

A Cascading Style Sheet (CSS) is a simple design scripting language intended to simplify the process of making web pages more visually appealing with the kind of high-level formatting. Cascading...

3 minutes read.

CSS Ellipsis

The CSS ellipsis kind of is the value that mostly is used by the property: text-overflow. Here, we will discuss the following: What is CSS Ellipsis? Syntax for CSS ellipsis How to...

3 minutes read.

CSS Tutorial

CSS refers to the Cascading Style Sheet. CSS is a form of a programming language. In other words, CSS is a language of the style sheet that is utilised for...

9 minutes read.

CSS Dropdowns

Dropdowns are one of the maximum crucial parts of an interactive internet site. CSS is a kind used to design the drop-down menus. A drop-down essentially is a group of...

5 minutes read.

Difference between HTML and CSS

HTML HTML stands for HyperText Markup Language and is used to create web pages and websites and web applications, which means we can create static web pages. Html is a scripting...

3 minutes read.

CSS Flex-Box

Introduction The flex-box property of CSS stands for Flexible Box Layout Module. It is specifically used to design a flexible responsive layout. Flex-box is a one dimensional layout model, i.e. it works...

6 minutes read.

CSS Color Keywords

Here, we will discuss the following keywords: transparent currentcolor Inherit Transparent keyword A color can generally be made transparent by using the transparent keyword. Often it is used to for all intents...

4 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.

CSS Reference

The CSS Reference lists all of the basic standard CSS properties, pseudo-classes, pseudo-elements, and data types, for all intents and purposes functional notations, and at-rules alphabetically.  The site also includes...

5 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 Pseudo-elements

Pseudo-elements The pseudo-classes in CSS can be represented as any keyword which is connected to the selector that represents any selected element’s unique state. On the other hand, pseudo-elements can be...

6 minutes read.

CSS Masking

CSS Masking The CSS mask property is applied to hide a component with the use of the masking or clipping an image at any specific point. The masking depicts the use...

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.