The CSS overflow property specifies how to handle the content when it overflows its block.
CSS provides overflow property tells the browser what to do if the box's contents is larger than the box itself.
The overflow property can take the following values −
visible : It is default value. It specifies that overflow is not clipped.The content renders outside the element's box
hidden : It specifies that the overflow is clipped, and rest of the content will be invisible.
scroll : It specifies that the overflow is clipped, and a scroll bar is used to see the rest of the content.
auto : It specifies that if overflow is clipped, a scroll bar is needed to see the rest of the content.
Example : CSS - Scrollbars
<!DOCTYPE html>
<html>
<head>
<style>
div {
background-color: #eee;
width: 200px;
height: 80px;
border: 1px dotted black;
overflow: hidden;
}
h6 {
background-color: #eee;
width: 200px;
height: 50px;
border: 1px dotted black;
overflow: scroll;
}
</style>
</head>
<body>
<h6> The CSS overflow property specifies how to handle the content when
it overflows its block.CSS provides overflow property tells the browser what to do
if the box's contents is larger than the box itself.
</h6>
<div> The CSS overflow property specifies how to handle the content when
it overflows its block.CSS provides overflow property tells the browser what to do
if the box's contents is larger than the box itself.
</div>
</body>
</html>
When the above code is compiled , it produces the following result.
Result
The CSS overflow property specifies how to handle the content when it overflows its block.
CSS provides overflow property tells the browser what to do if the box's contents is larger than the box itself.