1

I am new to HTML and I am watching tutorials on YouTube.
The author decided to use normalize.css and also used * {margin:0; padding:0;} in style.css.

I thought normalize.css already contains that code and we do not have to specify * {margin:0; padding:0;} again. Is this correct?

ProGrammer
  • 976
  • 2
  • 10
  • 27
Mirich
  • 333
  • 2
  • 5
  • 19

2 Answers2

2

According to the latest version of normalize.css, it doesn't reset any elements' padding. Therefore, you may need to including padding: 0 to fit your need.

However, it's generally not a good practice to use * instead of specifying an elements or class. Here's another answer about this.

Hope it helps.

LouisTheTeemo
  • 218
  • 2
  • 7
2

normalize.css won't reset css like *{}, it's not a good way to set css. Many elements such like p you may want to keep margin. And if you want to clean body's margin, it's already done.

Here is what normalize.css do:

  • Preserves useful defaults, unlike many CSS resets.
  • Normalizes styles for a wide range of elements.
  • Corrects bugs and common browser inconsistencies.
  • Improves usability with subtle modifications.
  • Explains what code does using detailed comments.
MingxunBai
  • 46
  • 5