S it common to apply the `box-sizing: border-box;` declaration to all HTML elements as demonstrated in this exercise?


#1

Question

Is it common to apply the box-sizing: border-box; declaration to all HTML elements as demonstrated in this exercise?

Answer

Yes, applying the box-sizing: border-box; declaration to all HTML elements is a common reset aimed at “taming” the box model. This reset is particularly useful in responsive design where we want to create fluid width layouts. A more modern way to apply this reset looks like so:

  box-sizing: border-box;
}
*, *:before, *:after {
  box-sizing: inherit;
}``

Some of the CSS in this code snippet may not be entirely familiar to you. For now, just know that this code is more inline with box-sizing best practices.