Analysis of Failure Causes for 10 common W3C standard verification

Source: Internet
Author: User

W3C validation is sometimes difficult to operate, but you can use it to view errors caused by layout design. The verification program throws a large number of errors and warnings, indicating that your XHTML is not complete and may not be consistent on different browsers. The following ten subtle failures have made it difficult for a large number of programmers. We will tell you how to solve them. Before starting this article, we will introduce some issues that need to be paid attention to when using the W3C verification program.

Worry about the validators warning-if the validators say 12 errors and 83 warnings are found, ignore them and proceed to the next step.

One correction error at a time-Progress in order and correct one error at a time from top to bottom. HTML is browsed from top to bottom in a browser. These errors are displayed in the same order.

You need to refresh the code after each correction to make it take effect again-a small error will often lead to a crash error on the whole page. Therefore, if the operation is improper, "corrected error" may also lead to more errors. Make the Code take effect again after each correction, so that the problem can be completely solved.

With the above basic exceptions, let's take a look at the reasons for the ineffective layout design.

1. The div tag is not closed.

This is one of the most common causes of layout design failure. We are always surprised when we learn how many exquisite forum designs are ineffective. The survey shows that opening div labels is one of the most common design mistakes and one of the most difficult mistakes to diagnose. The validators sometimes point to the wrong option to enable the div tag, making the diagnosis as troublesome as a haystack.

2. troublesome embed labels

In the early 1990s S, Microsoft and Netscape browsers began to recognize nonstandard, unique fonts. Unfortunately, this means that W3C validators are not yet able to identify certain key HTML tags, such as "embed", even if these tags are already widely used. If you really want to get a strict DOCTYPE document type) Verification, you can only discard nesting.

If you want both the layout design and embedded media to take effect, try the Flash Satay method.

3. Improper DOCTYPE statement

DOCTYPE is not declared, or DOCTYPE is declared incorrectly at the beginning of the file, which is also a common error. According to general experience, Strict DOCTYPE is the highest level of validation that everyone pursues. Strict validation indicates that your webpage can be best displayed on all browsers. The Strict statement code is as follows:

4. Diagonal lines at the end

If your website cannot be verified, it is likely that a backslash is missing somewhere in the code. We can easily ignore things such as ending slashes, especially in elements such as image labels. For example:

In strict DOCTYPE, this is invalid. Add "/" at the end of the img tag to solve this problem.

5. Align tag

If DOCTYPE is set to Transitional, you will use the "align" label, but if you want to get Strict verification for a higher requirement, you will see many errors. Align is another label that cannot be used for layout design. You can try to replace the align conversion element with "float" or "text-align.

6. JavaScript

If Strict DOCTYPE has been declared, the CDATA tag must be overwritten in JavaScript. This aspect of the validators makes it difficult for many programmers because websites tend to use embedded JavaScript for advertising and tracking scripts. If JavaScript is required, add the following labels before and after it:

7. The image requires the "alt" attribute

You may not have noticed that images are also a potential obstacle to advanced verification. In addition to trailing slashes, advanced verification also requires the use of alt tags to describe the image, such as alt = "Scary vampire picture ".

The search engine also uses alt tags to identify images on the web page. Therefore, adding alt tags is always good.

8. Unknown Entity Data

Entity Data is another mistake that affects verification. We can consider replacing "&" with appropriate encoding characters. The entire list lists the appropriate encoded character entity data available in the XHTML section design.

9. Poor nesting

Nesting is an element that includes

Sweet!

We can easily confuse the order of nested elements. For example, enable the strong label before the div label, but disable the div label first. This may not change the layout of the forum, but will invalidate the design of your forum.

10. The "title" label is missing.

Although this seems to be an obvious mistake, many programmers, including myself, often omit the title tag in the "head" section. When you see that "missing a required sub-element of HEAD" lacks the necessary child element of the HEAD, you will find that you forgot to add the title tag.

  1. Silverlight provides a browser-free experience
  2. PCWorld: Firefox browser declared dead

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.