Skip to content

Help us create more tutorials! Make a donation using the Donate button or become a member using the button below to hide this banner and track your progress.

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 Course > CSS Syntax