3

Anyone may be using some html(5) reset.css for example: http://html5doctor.com/html-5-reset-stylesheet/

html, body, div, span, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
abbr, address, cite, code,
del, dfn, em, img, ins, kbd, q, samp,
small, strong, sub, sup, var,
b, i,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section, summary,
time, mark, audio, video {
    margin:0;
    padding:0;
    border:0;
    outline:0;
    font-size:100%;
    vertical-align:baseline;
    background:transparent;
}
...

But instead I did:

* {
    margin:0;
    padding:0;
    border:0;
    outline:0;
    font-size:100%;
    vertical-align:baseline;
    background:transparent;
}

Advantages:

  • Looks simpler
  • weights less

Can anyone tell me if there is anything wrong with my solution (any browser thing, that I'm not aware of)?

Or what may be the advantages of listing almost all the tag names in this case?

George G
  • 7,443
  • 12
  • 45
  • 59
  • 1
    `*` is an extremely costly selector. – Terry Sep 26 '14 at 22:20
  • FYI: http://csswizardry.com/2011/09/writing-efficient-css-selectors/ – Terry Sep 26 '14 at 22:30
  • 1
    One of the advantages of explicit listing of elements to reset is the possibility to use the default appearance of form controls. When elements like 'input' have their default 'border' and sometimes 'padding' changed, they may change their look unexpectedly, irreversibly losing some default eye-candies of the browser theme. – Ilya Streltsyn Sep 26 '14 at 23:28
  • I found this: http://stackoverflow.com/questions/6880002/why-dont-css-resets-use-to-cover-all-elements – George G Oct 01 '14 at 11:21
  • CSS selector speed is not a concern. Consider: https://benfrain.com/css-performance-revisited-selectors-bloat-expensive-styles/ – Ben Frain Nov 03 '16 at 10:50

1 Answers1

4

I had the same question, so I searched it out and found this article:

http://www.cssreset.com/what-is-a-css-reset/

Which states "If your CSS Reset isn’t carefully written, you might find that your CSS rules are being themselves overwritten by the code that was supposed to be their baseline! This is often a problem when using the Universal Selector Reset, but won’t generally be an issue if working with well-written code such as the HTML5 Doctor CSS Reset."

Hope this helps!

Allen Levings
  • 142
  • 11