Agyan
adda
Run
Reset
Copy
CSS Tutorial › CSS Box Sizing › content-box vs border-box
Back to tutorial
Code
Edit, then press Run or Ctrl+Enter
<style> div { width: 250px; padding: 20px; border: 5px solid #333; margin-bottom: 10px; } .content { box-sizing: content-box; background: #ffe2d6; } .border { box-sizing: border-box; background: #d6f5e3; } </style> <div class="content">content-box: 300px wide</div> <div class="border">border-box: 250px wide</div>
Result