What are good css normalize/resets for a button?
I wanted to add some button normalization styles, but I was wondering what is considered good practice or not. I found around 3 options, the first being very simple and direct is
all: unset
, but I vaguely remember Kevin saying it's not really good to use that because It can remove some good/relevant styles and I'm not sure it's the case here.
The other ons ie the one below:
something in-between simple and thorough. But I found another one more extensive:
Which one you guys thing is the best one to use? Or if there's a 4ª option, I'm all ears.4 Replies
For the font things, I tend to just go with the font shorthand to do it all at once 😄 -
font: inherit
I also would never use line-height: inherit
for those. Other than textarea, they're all one-line, and I usually do something like line-height: 1.1
or even 1
for them to help make spacing easier to deal with.
I also wouldn't remove the margin and padding from them... I don't see the point in removing the padding? You'll probably be declarind something on them at one point anyway, why bother putting it to 0
?
As far as I know, all of those in that first list also don't have any margin in any browser? Safari used to (maybe FF too?) years ago, but looking at Safari, I think it was in 2013 that they removed it, I don't think we need to worry about that anymorefor the font, i would just inherit the font-size and font-family
an input with bold text will look really weird
the line height i would keep at 1.2 or 1.3, as 1.1 or 1 may cause cedils and accents to touch the letters above and bellow
maybe even emojis could have problems with that
Normalizing the button-border style might be interesting, but you should maybe just style the buttons themselves instead
Thanks everyone for the answers!