HTML and CSS Validators

HTML and CSS Validators

 

HTML and CSS need to be well formed and conform to best practices. The World Wide Web Consortium provides free markup validation services for these purposes.

The W3C Markup Validation Service

When your web page had problems, the first step to take is to validate the HTML and the CSS. Note that the HTML needs a proper doctype element at the top to simplify using an HTML validator. For HTML5 that is <!doctype html>. You can copy and paste into these validators and or upload the files from your computer.

Go to the W3C Markup Validation Service

The W3C CSS Validation Service

It is important to note that the CSS validators may not accept HTML so if you are using the <style>…</style> element, then copy and paste the contents of the <style>…</style> element and paste into the validator.

Go to the W3C CSS Validation Service

A rule of thumb is to work on the first errors you see and then fix them. Then validate again. Often one error may generate multiple errors from the validator because the validator gets lost.

CSSLint

CSS Lint is an open source CSS code quality tool that performs static analysis of source code and flags patterns that might be errors or otherwise cause problems for the developer. CSS Lint points out problems with your CSS code. It does basic syntax checking as well as applying a set of rules to the code that look for problematic patterns or signs of inefficiency.

Go to CSSLint