HTML, CSS and JavaScript

If you are on the quest to becoming an SEO, learning and understanding HTML and CSS is an integral part of that process. Up until a few years ago it was common knowledge that Google was not able to even read CSS markup. If you read SEO tutorials from 3+ years ago you might even find steps on how to block Google from your CSS or JavaScript. Getting in the habit of reading HTML and CSS is also recommended. After reading HTML for almost 20 years I’m able to spot an error in any piece of code in just a few seconds. It becomes almost inherent nature to find “un-closed” tags at the end of a statement.

Now, not only do we have confirmation that Google can read it, but they will warn you if you block them from it.
“Disallowing crawling of Javascript or CSS files in your site’s robots.txt directly harms how well our algorithms render and index your content and can result in suboptimal rankings.”
As an SEO, you don’t have to be an expert HTML and CSS coder with intricate knowledge of every HTML parameter. It is expected that you do know how to read HTML and CSS, can make changes to the code and are able to modify existing blocks of code. Without knowledge of HTML you really can’t understand the most important aspects of HTML such as title tags, meta descriptions and h tags.

Being able to read what is inside of thetag is also vitally important. Within thetag contains some of the most essential elements within on-page SEO, and should not be ignored. Knowledge of HTML and CSS also enables you to understand how to implement structured data, anchor text, images and so much more.

The role that CSS plays in SEO is very important. Not only does CSS make webpages much prettier, they make them much lighter in weight as well.

HTML / CSS Validation (w3.org)

Just like your content or text needs to be checked for grammar and spelling, your code needs to be checked for validity as well. W3.org is an international community where Member organizations, a full-time staff, and the public work together to develop Web standards. Basically, they are the people in charge of ensuring HTML is standardized. They’ve created a tool to validate the HTML and CSS on your website. We’ve found that almost every website “fails” on some level or another.

That is not to say you shouldn’t fix these issues. If you’ve ever run an “SEO testing tool” this is one of the main factors that they look for. While it has been stated in the past that Google does not give preference to websites that have validated HTML, that is not to say they don’t look down upon websites with tons of errors. For example invalid HTML could mean broken HTML elements which could mean improper formatting on your website. Poor formatting on your website could cause issues with your users which of course could lead to SEO’s.

In short, we would advise you to make sure all major issues are fixed, and if you have time fix the minor issues but don’t spend all your time focusing on HTML compliance. While CSS and HTML might not be a direct ranking factor, having properly optimized HTML tags

JavaScript

Over the past few years, JavaScript has become quite a hot topic in the on-page SEO community. When we first started doing SEO, we needed to proceed very cautiously when implementing JavaScript in a website. Now, Google has announced that not only are they able to crawl Javascript but they recommend you not block any resources such as external JavaScript files.

Google has made it really simple to understand by saying:
“What the user sees, the crawler sees.”
What Googlebot is actually doing is crawling the rendered static content, as well as executing JavaScript to create an HTML snapshot. In the past Googlebot would have to guess what the page looked like, because it couldn’t really read the JavaScript.

Our website for example loads several JavaScript files. Some of them are for basic elements, while others are for plugins within the WordPress framework. A few quick tips for JavaScript and SEO:

  • Minify your JavaScript, you can use tools like Jcompress to do this.
  • Don’t use a lot of JavaScript – JavaScript makes websites load slower, so less ir more
  • Keep JavaScript to content ratio low, and don’t use a lot in general
  • Try to keep JavaScript in the bottom or footer of your website
  • Try to use external JavaScript files instead of inline JavaScript

Googlebot also follows JavaScript redirects. This was always questionable in the past but now they are interpreted the same as 301’s. Googlebot also recognizes and follows links from within JavaScript, this includes menus, drop-downs and other types of links.
One aspect of JavaScript SEO’s (and Googlebot) has had a hard time with for a while is dynamically served content. Google has come out and said this is not a problem, and from my own tests I’ve run it does appear that Google does not have a problem with dynamically served content.
Historically SEO’s have shyed away from using JavaScript and even warned people about using it. This is really no longer the case for SEO’s as far as Google is concerned.
This is a major step forward within the SEO industry and a huge accomplishment for Google.
This is yet another reason why learning SEO is a dynamic process and something that you need to remain up to date on if you want to become an expert within the field.