Remove default margin/padding on elements;
hi, is there a proper way to turn off default margin and padding on html elements; I set both to 0 in the body tag but notice some children h1,p,ul tags still apply theirs. I don't want to override it each time for each scenario. is there a better way?
5 Replies
you can always nuke them with universal
*
selector *{margin:0;}
thankssss
is that generally a good or bad idea?
if you really don't want to deal with removing default margin from elements it's the only option some people use it some don't it's up to a preference 🙂
If you do nuke all margin like that you'll have to go in and add margin back into the elements you removed it from. You have to ask yourself which will be easier for you: removing margin from the elements you don't want it on or adding it to the elements you do want it on. It's a trade-off
Just don't do the same to padding and wonder why your list items are broken :p