HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link name="favicon" type="image/x-icon" href="https://skillzam.com/uploads/system/e353194f3b7cd1b75d69c3ab88041985.png" rel="shortcut icon" />
<title>Box Sizing</title>
<style>
/* noBox class selector with no box-sizing property */
.noBox {
background-color: lightblue;
border: 5px solid grey;
width: 200px;
height: 100px;
padding: 0 10px 0 10px;
}
/* yesBox class selector with box-sizing property value as "border-box" */
.yesBox {
background-color: lightblue;
border: 5px solid grey;
width: 200px;
height: 100px;
padding: 0 10px 0 10px;
box-sizing: border-box; /* box-sizing property value as "border-box" */
}
</style>
</head>
<body>
<!--
box-sizing : allows to include padding & border in an element's total width & height
Applying this property to all elements is safe & wise
* {
box-sizing: border-box;
}
-->
<h1>Demo: Box Sizing</h1>
<div class="noBox">
<p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Ad, labore.</p>
</div>
<br>
<div class="yesBox">
<p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Ad, labore.</p>
</div>
</body>
</html>