Prevent Padding change Element Width

Knowledge Base Entry: #115
^Top
<< Back
Mobile-Menu










Prevent Padding change Element Width
Category: CSS/Fixes
Author: Bugfish
Created at: 2020-12-21 19:55:51
Modified at: 2025-09-20 00:27:08
Directs Hits: 658

Use this property on an element to make sure that any padding or borders applied to it are included in its defined width and height, preventing the element from unexpectedly growing larger than the size you set and ensuring a more predictable, consistent layout when designing pages.

-webkit-box-sizing: border-box; /* Chrome */
-moz-box-sizing: border-box;    /* Firefox */
box-sizing: border-box;         /* Opera/IE */
Caution: I do not guarantee the reliability of the information given here, the code described on this page is executed at your own risk and in the event of damage or other unforeseeable consequences I am in no way responsible or liable.
This Website is using Session Cookies for Site Functionality.