Skip to content

Instantly share code, notes, and snippets.

@davidchase
Last active December 16, 2015 21:49
Show Gist options
  • Save davidchase/5502138 to your computer and use it in GitHub Desktop.
Save davidchase/5502138 to your computer and use it in GitHub Desktop.
"This gives you the box model you want. Applies it to all elements. Turns out many browsers already use border-box for a lot of form elements (which is why inputs and textareas look diff at width:100%;) But applying this to all elements is safe and wise." -- Paul Irish

Keep My Width

A nice article by Paul Irish read here.

It talks about keeping width the same on all elements without affecting performance regardless of adding padding.

One simple line of CSS and your back on track as long as you are dealing with IE8 + or other browsers.

/* apply a natural box layout model to all elements */
* { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment