box-sizing: border-box
Wouldn't it be better to use this in the CSS:
*, *:before, *:after { -webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing:border-box; }
It would save alot more space.
Re: box-sizing: border-box
Reply #1 –
Dangerous stuff, that generic selector.
Plus not compatible with oldIE. Means still having to write hacks for it.
Overall it's not much of a poblem. Either way.
Re: box-sizing: border-box
Reply #2 –
who cares about old IE? and what makes it "dangerous"?
Re: box-sizing: border-box
Reply #3 –
What makes it dangerous is that applying it blindly to all divs will break the jQuery menus, just as one example. Believe me, we tried it. The more verbose way ended up being safer.
Also, the generic selector is the slowest possible one, so generally not a good idea to use it unless it's really essenetial for some reason. Since the CSS files all get mashed together and minified and gzipped before being sent to the browser, a few extra lines of CSS aren't a big deal.
Re: box-sizing: border-box
Reply #6 –
I am already using it on Protendo - and have no problems with etiher css, speed or js(Mootools)
If the JQuery menu breaks from it - fix that menu instead.
Re: box-sizing: border-box
Reply #9 –
Oh, I see that Bloc removed his account from ElkArte as well, it's not just me... I'd check at SMF as well, but I don't want to go there™ these days.
Anyway, just wanted to say that I tried this 'technique' as mentioned above, but ultimately I decided against it, because it caused a lot of trouble, and yes, I was able to fix it every time, but then something else would come, and... I've only got so many hours to devote to this tweak, right..? So I reverted my changes, but remain hopeful for a better future.
It's definitely something that should be in a any 'bootstrap' project, but grafted onto an existing large project? Good luck, I guess.
Re: box-sizing: border-box
Reply #11 –
Qick example; two boxes with width: 50% and a border of 1px would be more than 100% and ruin your layout.
with box-sizing: border-box; the border is part of that 50%, without border-box it's added to that 50%;