Common Validation Mistakes
Be sure to check your pages with a validator. Use the W3C validator ( validator.w3.org ). A valid (ie, conforming to all rules) XHTML document is a document that satisfies the technical specification. In order to comply with it and successfully pass the test for correctness, it is necessary to follow certain standards when laying out the site.
Here is some of them:
Mandatory close tag
An unclosed tag is one of the most common and time-consuming debugging errors. The validator can't always find a matching open tag, so it's like looking for a needle in a haystack.
Missing or incorrect DOCTYPE declaration
A common mistake when creating a web page is the missing or incorrect DOCTYPE declaration at the head of the document. An accurate and correct DOCTYPE record is the key to the correct display of the site in different browsers.
It will look like this:
At the end of unpaired tags (for example, img or br), you should write a slash /.
Images should always have an alt attribute.
Images are a potential stumbling block to code validation. In addition to the paired closing slash, they also require the indication of the "alt" attributes, which is the description of this image.
Special characters. IMPORTANT!
Usually such errors are stored in links. Special characters - interfere with the correctness of code verification. Instead of using characters like "&", you need to specify their XHTML counterparts, for example: & amp;
Proper tag nesting.
Nesting is the arrangement of elements within other elements. For example, like this:
Very often the nesting order gets mixed up. For example like this:
Often this will not change how the document is rendered in a browser other than ie, but it will prevent the code from validating properly.
<ul> must contain at least one <li>
Often people try to nest block elements in inline elements.
You can only nest inline strings in inline files, and if you want to change inline to block-level, we use css for this.
Mandatory header tag.
Missing title tag. If you see an error in the site name in the browser, then you should know that you most likely missed the title tag.