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


#1

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