4 ms·
Incredible. I wish someone had told me this a few years ago, would have saved me a ton of grief. Jeremy Keith said it best in the comments: "box-sizing: border-
by 54mf 15y ago
Incredible. I wish someone had told me this a few years ago, would have saved me a ton of grief. Jeremy Keith said it best in the comments: "box-sizing: border-box is the bee's knees."
- cleverjake 15y agoThe way I have been getting around this until the last year or so was just double wrapping divs. Setting a wrapper to have the width you want with 0 margin and padding, and then assigning the padding and margin you want to the inner div does essentially the same thing
- 54mf 15y agoRight, exactly, and in a complex layout that adds a significant amount of extra markup. Not to mention trying to find which of the 4 or 5 columns is the one that's breaking the width of their container and causing the last column to break below the rest. It works, and has worked for me for a long time, but it's a hack.
- cleverjake 15y agooh, without a doubt. I kissed the earth when I found that IE 8 supported border-box, my point was just that there were hacks around the issue before now.
- deleted 15y ago[deleted]
- cfontes 15y agoI also had to do that sometimes... but it make your code a lot more complex if you use it a lot.
- md224 15y agoJust wait until you discover Flexbox!
- kemayo 15y agoWell, if you'd found out about it a few years ago you'd plausibly still have felt an obligation to support IE7, and thus been unable to use it.