4

Possible Duplicate:
(why) is the CSS star selector considered harmful?

I noticed that many CSS developers reset the margin, font and padding of a big number of HTML elements by explicitly declaring them all in the beginning (e.g.Yahoo and meyerweb versions). So I ask myself, why not simple reset globally using the *? I know that this break the layout for some elements like buttons and blockquotes but those can easily be restyled, which is a must if you really want to reset the layout because buttons have different looks in all browsers.

Community
  • 1
  • 1
aardbol
  • 2,147
  • 3
  • 31
  • 42
  • Performance-wise would be the most logical reason, yes. – aardbol Feb 21 '11 at 21:05
  • @BoltClock @EarthMind Is it even measurable/noticeable? Somehow I can't imagine performance being an issue at all here. – Elbert Alias Feb 21 '11 at 21:06
  • ElbertF, you should read about browser reflow if you haven't already. It really matters if you want the user experience to be as optimal as possible. Of course this hardly matters for small websites. – aardbol Feb 21 '11 at 21:11

2 Answers2

2

I think you just answered yourself - it's not simple restyling buttons and form controls because all user agents have very specific styling catering toward them.

meder omuraliev
  • 183,342
  • 71
  • 393
  • 434
  • It's not? I've almost always restyled buttons and text input elements to make the design look the same in most browsers. I do know that older IE browsers caused problems with button backgrounds. – aardbol Feb 21 '11 at 21:05
1

I think the idea of targeting specific controls was to improve performance. Apparently the "*" selector is very expensive. Otherwise, I don't believe using something like the below would have much impact other than performance ( Which is debatable I suppose )

* { margin:0; padding:0; }
Hux
  • 3,102
  • 1
  • 26
  • 33