Good day dear. Tell me please, (those who understand SEO), how critical is it to have valid HTML, CSS, JS codes? (if you can explain on each item) PS Quite often in articles I meet expressions. "validity for the sake of validity" (written with sarcasm) seems to be like specialists solve layout problems with the help of obviously not valid methods (so as not to put crutches in the code) and consider that these are perfectly acceptable solutions

3 answers 3

The problem of invalid layout is that different browsers can understand it differently. As a result, you will never know whether the search robot correctly understands your invalid layout .

Moreover, the algorithms of search robots are changing. And sometimes new ones appear - the same google once upon a time was an incomprehensible new site ... Any new version of the robot will understand the valid layout as it was intended. But with an invalid can get an unpleasant surprise.


It should be understood that intentionally invalid layout - this is a crutch. Transferring the crutch from the code into the layout - you do not get rid of the crutch, as you would not want to think the opposite.

And we must understand that validity is different. HTML 4.1, XHTML, HTML 5 are three different standards, and the layout valid in one of them will be invalid from the point of view of the other. Therefore, to check the site with random web validators, and then immediately rush to correct everything, and the truth is not worth it. It is usually enough to ensure that your editor correctly highlights the syntax and does not find errors - the last standard (HTML 5) forgives very much for layout and this is documented behavior.

    Probably you mean by the validity of the code - its correctness. Before the browser displays the web page, it must build the DOM document object model .

    • The browser reads the original HTML bytes from the server or network disk and translates them into separate characters based on the specified file encoding (for example, UTF-8).
    • The browser converts a string of characters into different tokens — as specified in the W3C HTML5 standard . For example, "", "<body>" - and other lines in angle brackets. Each marker has a special meaning and its own set of rules.
    • emitted tokens are converted into "objects" that define their properties and rules.
    • DOM construction: since HTML markup defines the relationship between different labels (some tags are contained in other tags) the created objects are linked in the tree data structure, which also captures the parent-child defined in the original markup: the HTML object is the parent of the body object, the body is the parent object item, and so on.

    W3 documentation on DOM . This whole process takes some time, especially if we have a large amount of HTML to process. The more code, the longer the browser processes it. This affects the page loading speed, which is critical for mobile users - statistics reports that they wait no more than 3 seconds and then leave. And this is currently - between 50% and 60% of all traffic on the network. You can see that reading / creating a DOM is a rather complicated process. Now imagine that in the source code of the page there is only one error (not to mention many errors), or even there is a fatal error. You can see how complicated the browser is in this case. The HTML5 standard is quite liberal and the browser can understand the concept of your web page, even if the source code has several errors. But the more mistakes, the more blurred the meaning of the concept of a web page and the more time the browser takes. Because of this, the download speed increases. Also, multiple source code errors make it difficult for mobile users to understand the webpage correctly. In addition, structured markup is closely associated with the source code. This markup is used for rich results in search + for voice search + for machine learning. Finally, source code errors are a violation of the CTML5 standard. As a result, you can get only with source code errors: the loss of 50% -60% of traffic is mobile users, problems with the web site in the mobile index, browsers and search engines cannot correctly understand your site and its structure, lowering the search rank .

      How critical is it to have valid HTML, CSS, JS codes?

      The answer to this question can be VERY easy to find yourself. You take sites from the TOP and check for validity.
      And try to find at least one 100% valid :)

      But this does not mean that you need to intend to allow shoals.

      Quite often in articles I meet expressions. "validity for the sake of validity" (written with sarcasm)

      This is a thick hint that you should not lick the validity on an already lively site that was not originally laid out by you (all its elements). It is better to give strength to more productive activities.