Style Inheritance

Next, you are going to add styles to change the size and appearance of the text.

Add a new styling rule in styles.css to set the font size for the body element. To do this, you will use a different type of selector – an element selector – by simply using the element’s name.

body {
  font-size: 10px;
}

.thumbnail-title {
  display: block;
  margin: 0;
  padding: 4px 10px;

  background: rgb(96, 125, 139);
  color: rgb(202, 238, 255);
}

This styling rule sets the body element’s font-size to 10px.

You will rarely use element selectors in your stylesheets, because you will not often want to apply the exact same styles to every occurrence of a particular tag. Also, element selectors limit your ability to reuse styles; using ...

Get Front-End Web Development: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.