Overview of This Lesson

You already learned about validating your HTML code and why it's important to do so. You should also validate your CSS, and the reasons are the same. Validating CSS code is also just as simple as it is with HTML!

Validating CSS

As you know from learning HTML, having valid CSS is important for consistency, professionalism, accessibility, and many other reasons. To validate your CSS code, you can use the W3C CSS Validation Service (opens in the ref tab). It functions exactly like the HTML validator: you can validate by URL, by uploading your file, or by copying and pasting your CSS into the "direct input" field.

css validator screen, direct input
The W3C CSS Validator Service

The validation options are also similar to the ones discussed with the HTML Validator, and you'll receive similar output.

You can give it a try with this CSS code: copy and paste it into the CSS validator and see if you can understand the errors it produces:

header, footer {
border: .2em grey solid;
  border-radius: 5 px;
}
h1 {
  color : navyblue;
}
foo {
  background color: 333;
}

What constitutes valid CSS?

What kinds of things will bring up errors in the validator and what are the industry standards for CSS code?

Syntax:

Coding Standards