JSFiddle - React, Tailwind, and code Playground
HTML
<div class="unpadded">Unpadded. This is 200px regardless of box sizing.</div>
<div class="boxSizing">With box sizing applied, this div is still 200px even though there is padding and a border.</div>
<div class="noBoxSizing">With padding and a border but no box sizing, the div grows larger than its specified width</div>
CSS
div {
width: 200px;
height: 100px;
border: 2px solid red;
padding: 5px;
color: white;
text-align: center;
font-family: sans-serif;
font-size: 16px;
}
.unpadded {
background-color: blue;
padding: 5px 0;
border-width: 0;
}
.boxSizing {
background-color: green;
box-sizing: border-box;
-moz-box-sizing: border-box;
}
.noBoxSizing {
background-color: navy;
}