-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix global CSS bad practices #2460
Comments
It can easily be overridden in the case you need it to be. |
So why isn't it like that by default? Right now it's just bad. |
To note: This also has a significant drawback on CSS rendering performance. Measured with Chrome's profiler. I think FontAwesome project will remove this selector for this reason. |
@staaky Disagree. This is an incredibly useful rule, if you haven't read the explanation why, and the recommendation to use this rule by @paulirish you should: |
I don't see why someone would recommend such a thing, he wrote that in 2012, pretty sure he changed his mind by now. Global css rules like this, affecting everything related to layout are a bad practice if you want anything to work with third party scripts. You can't expect everyone out there to conform to something that isn't a default. So a reset like that might seem useful if all you have to care about is your own code, but those are edge cases for most. If this is a framework that's supposed to advocate best practices such css rules just don't belong. |
It's recommended because it makes the box model behave as expected. It is incredibly useful and I very much doubt that @paulirish has changed his mind, he tends to update previous posts whenever that is the case. |
i still think border-box is fantastic. :) also as another datapoint bootstrap 3 ships with but since most major 3rd party widgets have already addressed issues caused by the global border-box style. |
@nternetinspired With @paulirish yes, only using There's nothing wrong with |
Didn't realize it was THIS controversial, but okay. Foundation was developed primarily as a means for us to quickly build out client work, and having a consistent rule for how padding and sizes are calculated is much more efficient for our team and other teams that use Foundation than having to wrangle border-box AND content-box depending on what you're working with. In general, we also prefer simplicity when it comes to philosophical decisions. border-box on * is simple, if we did it on the component level would we do it for all of them? Some? Which ones are more likely to be used with 3rd party plugins or scripts that don't plan for border-box and should we omit using it on those? Gets muddy. Good discussion, and if someone can sell us on a more specific approach we're all ears. Just our 2 cents. |
I'm all for convenience and simplicity, but not when it breaks expected behavior. 3rd party scripts should just work without anyone having to deal with a global reset of the box-model. A css rule that covers only foundation components could also be simple. Depending on how things are set up it could for example be something like That might have to be more strict to make sure it only covers your own components. Content pulled into a component for example would ideally also have Simple solutions will always have some kind of drawback, it all depends on how strict you want to be. If it was up to me simplicity would be a non-issue, I'd make sure to only cover my own components. |
This CSS rule is affecting every third party script out there. Changing box-sizing on everything is a very bad practice:
It should be changed to target only the elements that need this so third party scripts aren't affected.
The text was updated successfully, but these errors were encountered: