HTML, CSS and JavaScript files should be valid to avoid issues that may impact search engines and visitors.

While contemporary Web browsers do an increasingly good job of parsing even the worst HTML β€œtag soup” … different software on different platforms will not handle errors in a similar fashion …

W3C, “Why Validate?”

Use valid HTML

Pages should be free of HTML validation errors. Invalid HTML can cause problems to users as pages may not be displayed as you intended. Browsers differ in how they treat invalid code so you should always use valid HTML to avoid browser specific issues. Likewise, search engines trying to interpret invalid HTML may misunderstand the content of a page.

Use valid CSS

CSS files should be free from syntax errors. Invalid CSS can cause pages to be incorrectly displayed which means visitors may not see your content as intended. CSS errors could also impact search rankings as for example Google says pages can be penalized if CSS causes page content to be hidden.

Use valid JavaScript

JavaScript files should be free from syntax errors. JavaScript can modify the look, content and behaviour of a page so JavaScript errors can cause pages to be displayed incorrectly and break interactive elements. This can hurt user experiences and impact search rankings.

More articles in this series

➜  This article is from our comprehensive SEO Best Practices guide.

➜  Next article in this series: Links

➜  Previous article in this series: URL names