Skip to content

Instantly share code, notes, and snippets.

@gayanvirajith
Last active August 29, 2015 14:04
Show Gist options
  • Save gayanvirajith/d6dafa5950b94438a5fd to your computer and use it in GitHub Desktop.
Save gayanvirajith/d6dafa5950b94438a5fd to your computer and use it in GitHub Desktop.
CSS box-sizing best practice
// 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