Sobes.tech
Junior

What is the difference between reset.css and normalize.css?

sobes.tech AI

Answer from AI

Main differences:

  • reset.css: Removes all default browser styles (margins, fonts, etc.), creating a "clean slate" for development. May require more effort to restore basic styles.
  • normalize.css: Smooths out differences in how elements are displayed across browsers, while preserving some useful default styles. The goal is to make elements appear more consistent.

Comparison table:

Characteristic reset.css normalize.css
Purpose Remove all styles Make styles consistent
Impact on styles Complete removal Smoothing differences
Basic styles Require restoration Are preserved
Typical usage To get a "clean" baseline To unify display

Example of using normalize.css:

/* 
 * 1. Correct the line height in all browsers.
 * 2. Prevent adjustments of font size after orientation changes in iOS.
 */

html {
  line-height: 1.15; /* 1 */
  -webkit-text-size-adjust: 100%; /* 2 */
}