mu
mu copied to clipboard
Remove global box-sizing and universal selector
Hello.
Maybe it is not such a good idea to use box-sizing: border-box globally. Should use it only where it is needed. Let's keep it as default content-box because this is what developers expect.
The universal selector is know to be slow and this is agains motherfucking ideas.
Here is a pull request.
Hi,
Interesting point but the default box sizing is not really intuitive and almost every framework and dev use box-sizing and it's available almost everywhere but I am open to the idea.
Concerning the performance, I quote Paul Irish
You might get up in arms about the universal * selector.
Apparently you’ve heard its slow. Firstly, it’s not. It is as fast as h1 as a selector. It can be slow when you specifically use it like .foo > *, so don’t do that.
default box sizing is not really intuitive
It isn't. I agree. But it is default and here is a point. Now we, developers, separated into two camps, like Villariba and Villabajo. And sometimes we need to work together, our plugins and frameworks have to work together as well. Only one way to do it is to use standards, specifications and defaults. On the other hand it doesn't bring much troubles to calculate few paddings, really.
What for universal selector it is not a big disadvantage, but still disadvantage :)
From the other side if you use default content-box in framework I can use both of content-box or border-box in my project. If you set framework box-sizing to border-box I can use only border-box.
Just my 2 cents. Every framework is and should be opinionated. You can not fit to every case possible with it. So if you don't like the default behaviour, you customize it for your needs. Especially if the code base is that small.
Thanks for your feedbacks. I agree with @roxkisrover, I think that it is impossible to please everybody and in my humble opinion, I prefer border-box also because almost every framework use it so it's easy to shift.
It is hard do decide...
@BafS it is up to you of course, but you get it wrong. In case of framework you can please everybody. Just don't change default box-sizing. And all those frameworks you mention could do it as well. It will fit anyone if you use padding-box only in selectors you really need.