diff --git a/snippets/box-sizing-reset.md b/snippets/box-sizing-reset.md new file mode 100644 index 000000000..09d77a9b5 --- /dev/null +++ b/snippets/box-sizing-reset.md @@ -0,0 +1,44 @@ +### Clearfix + +Resets the box-model so that `width`s and `height`s are not affected by their `border`s and/or `padding`. + +#### CSS + +```css +.html { + box-sizing: border-box; +} + +*, +*::before, +*::after { + box-sizing: inherit; +} +``` + +#### Demo + +
Demo
+ + + +#### Explanation + +1. `box-sizing: border-box` makes the addition of `padding` or `border`s not affect an elements `width` and/or `height`. +2. `box-sizing: inherit` makes an element respect its parents `box-sizing` rule. + +#### Browser support + +✅ No caveats. + +* https://caniuse.com/#feat=css3-boxsizing