When to use a dot in styles.css and when not to?

When and how to I know when to use a dot or no dot with my selectors in the styles.css file?
Example:
.body{
}
versus
body{
}

Welcome to the forums! That’s a good question. You only use a “.” when you’re selecting a specified class inside an element. If you are selecting an element, you just type the element you want to select. No punctuation required. For example:

div {
  color: green;
}

That would select any div element in your code. But, if you want to select any elements that have the class “styles”, for example, then this would be the selector you would use:

.styles {
  color: green;
}

Hope this helps!

1 Like

It totally helped!
Thank you!!

1 Like