Cause Analysis of invalid css in CSS webpage layout

Source: Internet
Author: User
Tags html tags

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. 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.

II. 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. For more information about the types of DTD documents, see related articles.

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.
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.

VI. 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 ".
In the search engine tutorial, alt tags are also used to identify images on webpages. 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 elements. 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 a very obvious mistake, many programmers (including myself) often omit the title tag in the "head" section. When you see "missing a required sub-element of HEAD" (a child element is missing from the HEAD), you will find that you forgot to add the title tag.

Related Article

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.