Cafe Menu - CSS question - with or without a dot (.), step 75

Hi guys

I have just completed the step 75 and wondering how to recognize when the dot (.) before a class name should or should not be used?
In this step, for example, for bottom line is used: .bottom-line {}, however in the step before for hr isn’t supposed to be used as the correct code was: hr{}.

How to recognize which is supposed to have the dot and which doesn’t? (apart from what is classified as “class” in the HTML code?

Many thanks!

body {
  background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg);
  font-family: sans-serif;
  padding: 20px;
}

h1 {
  font-size: 40px;
}

h2 {
  font-size: 30px;
}

.established {
  font-style: italic;
}

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

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

hr {
  height: 2px;
  background-color: brown;
  border-color: brown;
}

.bottom-line {
  margin-top: 25px;
}

h1, h2 {
  font-family: Impact, serif;
}

.item p {
  display: inline-block;
  margin-top: 5px;
  margin-bottom: 5px;
  font-size: 18px;
}

.flavor, .dessert {
  text-align: left;
  width: 75%;
}

.price {
  text-align: right;
  width: 25%
}

Class selector need dot. Id selector need # hash and tags or elements need nothing with it, when you adding it for styling to CSS. @lulskul

1 Like

Helloo!
You get many different selector types.

  • Ones I can name out of the top of my head are :
  • element selectors (selects the element you enter)
  • class selectors (selects the class that is linked and this one uses the dot)
  • Id selectors ( selects the Id it’s linked to an Id and uses the #)
  • star selector (selects all html and uses the *)
2 Likes

Cheers to both of you guys!

2 Likes

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