Code validation - SEO Best Practices
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 β¦
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.
Learn more
- Does Googlebot care about valid HTML?www.youtube.com
- Webmaster Guidelinessupport.google.com
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.
Learn more
- Hidden text and linkssupport.google.com
- Understanding web pages betterwebmasters.googleblog.com
- Webmaster Guidelinessupport.google.com
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.
Learn more
- Hidden text and linkssupport.google.com
- Understanding web pages betterwebmasters.googleblog.com
- Webmaster Guidelinessupport.google.com
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