Created
November 9, 2014 22:42
-
-
Save radiovisual/0607b4a1150e2edb8c99 to your computer and use it in GitHub Desktop.
box-sizing recommendation to help fix the annoying box model issues in html/css
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
/*Ugh. If I say the width is 200px, gosh darn it, it’s gonna be a 200px wide box even if I have 20px of padding. | |
So as you know, this is NOT how the box model has worked for the past ten years. Anyway, I have a recommendation | |
for your CSS going forward: (Paul Irish via: http://www.paulirish.com/2012/box-sizing-border-box-ftw/) */ | |
/* apply a natural box layout model to all elements, but allowing components to change */ | |
html { | |
box-sizing: border-box; | |
} | |
*, *:before, *:after { | |
box-sizing: inherit; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment