Skip to content

Try our new Crash Courses!

Buy one of our new Crash Courses, now hosted on Podia.

Common syntax problems – CSS

Summary

Here’s a list of some common mistakes you might make while writing CSS code. These mistakes can cause different errors on your webpage, so it’s important that you correct them if you see them in your code.

  • Missing opening or closing curly brace
  • Missing colon after the property name
  • Missing semicolon after value
  • Misspelled selector, property, or value

Details

Missing opening curly brace:

p
  color: red;
}

Missing closing curly brace:

p {
  color: red;

Misspelled property:

p {
  coler: red;
}

Misspelled value:

p {
  color: redd;
}

Misspelled selector:

bodyy {
  color: red;
}

Missing colon after the property name:

p {
  color red;
}

Missing semicolon after the value (this is only a problem if there is more than one property in the CSS rule):

p {
  color: red
  background-color: blue;
}

Exercises

There are no exercises for this lesson.

References

No references available.

Back to: CSS Reference > CSS Syntax