Last active
August 29, 2015 14:04
-
-
Save gayanvirajith/d6dafa5950b94438a5fd to your computer and use it in GitHub Desktop.
CSS box-sizing best practice
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Credit Source: | |
// http://css-tricks.com/inheriting-box-sizing-probably-slightly-better-best-practice/ | |
// -------------------------------------------- | |
// box-sizing to border-box | |
// -------------------------------------------- | |
html { | |
box-sizing: border-box; | |
} | |
*, *:before, *:after { | |
box-sizing: inherit; | |
} | |
// -------------------------------------------- | |
// Overriding default box-sizing | |
// box-sizing to content-box; | |
// Following class works on default content-box in box-sizing. | |
// -------------------------------------------- | |
.some-class { | |
box-sizing: content-box; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment