i

Learn HTML and CSS in 10 Days

Drop Units Zero Values

To cut down the size of CSS code, the best way is to get rid of the unit from any zero value. It doesn't matter which length unit is getting used – percentage, em, pixels, and so forth – Zero is always Zero. Summing up, the unit is not important and offers no additional value.

Bad Code

div {

  margin: 20px 0px;

  letter-spacing: 0%;

  padding: 0px 5px;

}

 

Good Code

div {

  margin: 20px 0;

  letter-spacing: 0;

  padding: 0 5px;

}