Box-sizing property is used to change the height and width of the element. Since CSS2, the box property has worked like as shown below −
width + padding + border = actual visible/rendered width of an element's box height + padding + border = actual visible/rendered height of an element's box
Example
To understand the box-sizing property, let us see an example:
<html>
<head>
<style>
.div1 {
width: 300px;
height: 100px;
border: 1px solid blue;
box-sizing: border-box;
}
.div2 {
width: 300px;
height: 100px;
padding: 50px;
border: 1px solid red;
box-sizing: border-box;
}
</style>
</head>
<body>
<div class = "div1">TutorialsPoint.com</div></br>
<div class = "div2">TutorialsPoint.com</div>
</body>
</html>