Intermediate CSS CSS Boilerplate

Learning objective: By the end of this lesson, students will be able to explain what CSS boilerplate is and why it’s useful.

CSS Boilerplate

CSS boilerplate refers to a set of pre-defined CSS rules and styles commonly used as a starting point in web development. CSS boilerplate provides a consistent and normalized foundation for styling web pages, making it easier to create cross-browser and cross-platform compatible designs. It is typically used to normalize the behavior of different browsers and provide a basic set of styles for common HTML elements.

Some of the most common CSS boilerplate rule sets include:

Here is an example that you could use in your work:

* {
  box-sizing: border-box
}

body {
  background-color: gray;
  /* Use a system font; if none are available, use an available sans-serif font */
  font-family: system-ui, sans-serif;
  /* Ensures full height compatibility across devices */
  min-height: 100dvh;
  margin: 0;
}

If you’re curious about dvh, check out this article for more details.