What other common CSS syntax errors should I look out for?

Question

What other common CSS syntax errors should I look out for?

Answer

Beyond making sure your CSS declarations are separated using a semicolon, be on the lookout for other syntax issues in your CSS like:

  • incorrect syntax for selectors, e.g. class selectors begin with a period: .class-name
  • making sure each declaration block starts with an opening curly brace, {, and ends with a closing curly brace }
  • using correct syntax for CSS property names and values, ex: background-color: lightblue; not background color: light-blue;
  • separating property name from the value with a colon
  • typos

Typos seems to be a big one for me I have to keep my class names super simple. To try to avoid a typo from messing up my styling. I’m hoping I out grown this as I learn to type better

You can just copy + paste the complex class names. Of course, try to keep all your class names as simple as possible, however, sometimes they can get complex. In this case, just copy + paste them

A post was split to a new topic: The 11th challenge was quite confusing