Why in css "reset" operations is it not recommended to use the asterisk?

4

I've seen several internet tutorials about css reset teaching that you should never use asterisks to apply the modifications.

For example:

* { margin:0; padding:0; }

But along with the claim that doing this is problematic, I've never seen an explanation of why you can not do this .

What is the reason why using the asterisk in css is not recommended? Is there any risk?

    
asked by anonymous 18.02.2016 / 17:58

1 answer

3

Using "*" you are selecting ALL elements of HTML , which does not make much sense. An example: the <p> by nature tag already comes with a margin-top and a margin-bottom set, if you remove those spaces you will probably need to add them again later, since they are the default spaces in the paragraph, and without them the texts will stick together.

The reset is to leave the elements as "pure" as possible, removing any influence from the browser or some other remnant of CSS . It should not be applied to all elements.

That's what I think, right.

    
18.02.2016 / 18:52