Does CSS Validity Affect SEO?

- 1 answer

Many front-end developers know that valid HTML has a positive effect on SEO. But does a valid CSS affect SEO?

On the Google website on the page it says: "Clean, valid HTML is a good insurance policy, and using CSS separates presentation from content, and can help pages render and load faster. Validation tools, such as the free online HTML and CSS validators provided by the W3 Consortium, are useful for checking your site, and tools such as HTML Tidy can help you quickly and easily clean up your code."

But if you look at the world’s most popular front-end component library, for example, you can see that even it contains a lot of errors and warnings from the W3C validator.

    --font-family-sans-serif: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    --font-family-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace
} ... <= This is just a small part of the file bootstrap.min.css.

The validator says there are 30 errors and 670 warnings in the Bootstrap. But this CSS is used on many successful sites. Would they be even more successful in SEO if they used a valid CSS?



In their general guidelines for browser compatibility, Google mention the W3C validation tools for writing good, clean code.

They also state the following:

Although we do recommend using valid HTML, it's not likely to be a factor in how Google crawls and indexes your site.

So we can assume this also is the case for CSS.

Keep in mind that there are a lot of other things in your CSS that will affect the search ranking, like mobile-friendly styles, and factors that causes slower loading times like selector specificity, file size, imports etc.