3 ms·
Are you aware that you can achieve visually identical effect with `box-sizing`? (it can change "W3C" box model to "quirks" box model on any container) widt
by pornel 15y ago
Are you aware that you can achieve visually identical effect with `box-sizing`? (it can change "W3C" box model to "quirks" box model on any container)
width: 25%;
padding: 10px;
border: 5px;
box-sizing:border-box;
gives same effect as:
width: calc(25%-10px-5px);
padding: 10px;
border: 5px;
Also, it would be nice if your framework had at least half-decent fallback for browsers without calc() (I think `width:24%` would be better than leaving it auto).
- netghost 15y agoFor anyone interested, I actually had written up an article on box-sizing yesterday: http://monkeyandcrow.com/blog/splitting_the_difference/ http://monkeyandcrow.com/blog/splitting_the_difference/ There's an example illustrating pornel's point.
- vladocar 15y agoI actually wanted to use margins, yes is true if you use padding the box model can help, here is good explanation about the http://www.quirksmode.org/css/box.html http://www.quirksmode.org/css/box.html box model.