Web Designers use the overflow property to add a scrollbar when the width or height of the content is bigger than the container size.
The overflow property is used to fit the content inside the containers with horizontal or vertical scrollbars
<style>
/*example*/
.tdb-overflow{
width:100px;
height:100px;
overflow:auto;
}
</style>
<head>
<style>
.tdb-overflow{
width:60px;
height:100px;
overflow:auto;
}
</style>
</head>
<body>
<h1 class="tdb-overflow">Overflow property</h1>
</body>
Overflow-x property is used to fit the content inside the containers with a horizontal scrollbar.
<style>
/*example*/
.tdb-overflow{
width:100px;
height:100px;
overflow-x:auto;
}
</style>
<head>
<style>
.tdb-overflow{
width:60px;
height:100px;
overflow-x:auto;
}
</style>
</head>
<body>
<h1 class="tdb-overflow"Overflow property</h1>
</body>
Overflow-y property is used to fit the content inside the containers with vertical scrollbar.
<style>
/*example*/
.tdb-overflow{
width:100px;
height:100px;
overflow-y:auto;
}
</style>
<head>
<style>
.tdb-overflow{
width:60px;
height:50px;
overflow-y:auto;
overflow-x:hidden;
}
</style>
</head>
<body>
<h1 class="tdb-overflow">Overflow property</h1>
</body>
Overflow: visible is the default value of the CSS3 Overflow property. The overflow is rendered outside the container box.
<style>
/*example*/
.tdb-overflow{
width:100px;
height:100px;
overflow: visible;
background-color:black;
color:orange;
}
</style>
<head>
<style>
.tdb-overflow{
width:100px;
height:100px;
overflow: visible;
background-color:black;
color:orange;
}
</style>
</head>
<body>
<h1 class="tdb-overflow">Overflow property</h1>
</body>
By using this property. The overflow is clipped, and the vertical and horizontal scroll bars are added to the HTML container classes.
<style>
/*example*/
.tdb-overflow{
width:100px;
height:60px;
overflow: scroll;
background-color:black;
color:orange;
}
</style>
<head>
<style>
.tdb-overflow{
width:100px;
height:60px;
overflow: scroll;
background-color:black;
color:orange;
}
</style>
</head>
<body>
<h1 class="tdb-overflow">CSS3 overflow property</h1>
</body>