Need a quick reminder for style.css

Hello,

Could someone me understand what the difference is between having a period in front of the “h” and not having one? For example the h1 line does not require is but the menu one did.

Thanks for any help!

h1, h2, p {
  text-align: center;
}

.menu {
  width: 80%;
  background-color: burlywood;
  margin-left: auto;
  margin-right: auto;
  padding: 20px;
  max-width: 500px;
}

Hello!

The period marks the selector as a class selector, meaning that you’re going to style all elements with a certain class (for example “menu”) regardless of the type of element this is.
Without the period, it’s an element selector, meaning you’re styling all x elements (x being replaced by h1, h2, p…).

Hope it helps, and good luck!

2 Likes

that is very helpful, thank you!!

1 Like

You’re very welcome!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.