3 ms·
There are two schools of thought for CSS resets. 1. Minimize differences between browsers, keep some things like default padding, and styling where it makes sen
by fyrn_ 3y ago
There are two schools of thought for CSS resets.
1. Minimize differences between browsers, keep some things like default padding, and styling where it makes sense
2. Nuke everything, standarize box-sizing, etc..
And I lied, there are also some that are more in between, but that's the jist.
The main argument for #1 is that it's closer to vanilla and lighter weight.
The main argument for #2 is that of you're making a comprehensive style, it's nicer to not have to worry about how for input elements have wierd legacy behavior, or to have to have a list of non standard box-sizing elements and a bunch of other weird legacy style anachronisms open all the time.
I personally, and I've seen this happen to others started out in camp #1 and eventually transitioned to camp #2 after I realized just how weird some stuff is. It definitely didn't mame sense to me until I had a lot of CSS experience.
- crazygringo 3y agoYup. In my experience, the main argument for #2 is that it's just too hard to remember/bother with what some default margin or padding is in the first place. If it's nonzero, it's always going to be something extremely arbitrary, and will almost never be the value that matches your design anyways. Best to just nuke it all and make every positioning decision consciously. And when you forget to set something, it'll be quite obvious where it needs to be fixed.
- wwweston 3y agoI guess I'm definitely a #1 person, because I don't understand how #2 relates. By all means, standardize all the things to remove variation -- that resonates pretty strongly with me. But I don't get how "standardize" shifts to "zero-out."
- makeitdouble 3y agoWhen you standardize on any other number you have to remember it and account for it. For instance if you settle for 2em margins, all you other margin calculations need to remember that 2em value, and you also need to teach all your new coworkers the 2em value. That's dramatically less needed if it's 0.
- wwweston 3y agoRemembering / managing multiple margin values is a conversation that I can definitely relate to having about a design system or custom CSS. For a reset/normalization sheet focused on sane standardized defaults? Seems like we'd be talking about two numbers: whatever vertical margin you want for your block level elements that you'd expect to have margins (most likely 1em) and 0. Where are the other numbers coming from in the context of a reset?
- fyrn_ 3y agoThere's other stuff besides numbers, like box-sizing and display that you uave to remember if you don't reset them.