10 common reasons why CSS is not valid in a DIV+CSS page layout

Source: Internet
Author: User

learning div+css Web layout knowledge, but brother Lian , Validator throws a lot of errors and warnings stating that your XHTML is not well-established and may not be able to maintain consistent functionality across browsers , brother Lian basic div+css issues to be aware of when validating programs.

1. Do not worry about the validator warning: if the validator says it found 12 errors and 83 warnings, ignore it and proceed to the next step.

2. Correct one error at a time: in order to progress the work, from top to bottom, fix one error at a time. HTML is browsed from top to bottom in the browser, and these errors are displayed in the same order.

3, after each correction code to refresh the code, so that they re-effective: A small error will often cause the whole page after a series of errors. Therefore, if you do not operate properly, "fix errors" can also cause more errors. After each correction, the code is re-enacted, so that you can ensure that the problem is resolved completely and that you know the basic anomalies above, let's take a look at some of the reasons why the layout design is invalid.

One, div tag is not closed

This is one of the most common reasons for the failure of the layout design. When we learn how much of this is the main culprit for the failure of the fine-design section, it's always a surprise. The Open div tag is one of the most common design mistakes in the section and one of the hardest mistakes to diagnose. The validator sometimes points to the wrong open div tag, which is as troublesome as a needle in a haystack when diagnosed.

Second, the trouble of Embed label

In the early 90, browsers from Microsoft and Netscape began to recognize non-standard, unique fonts. Unfortunately, this means that the certification process

some key HTML tags, such as "embed", are not yet recognized, even though these tags are already widely used. If you do want strict DOCTYPE (document type) validation, you can only discard nesting , and if you want to work with both layout and embedded media, try the flash Satay method.

Iii. Improper Statement of DOCTYPE

It is also a common error to not declare DOCTYPE, or to declare doctype at the beginning of a file error. According to General experience, Strict DOCTYPE is the most advanced verification that everyone pursues. Strict validation shows that your Web page will be best displayed on all browsers. For a declaration of the DTD document type, you can refer to www.lampbrother.net 's related articles.

Four, trailing slash

If your site cannot be verified, it is likely that a trailing slash has been omitted somewhere in the code. It's easy to ignore things like trailing slashes, especially in elements like the image tag. This is not valid in strict DOCTYPE. To resolve this issue, add "/" to the end of the IMG tag.

Five, align label

If DOCTYPE is set to transitional, you will use the "Align" tab, but if you ask for a higher level of strict verification, you will see a lot of errors. Align is another label that is not available for layout design. You can try using "float" or "text-align" instead of the align transform element.

VI. JavaScript

If you have already declared strict DOCTYPE, you need to overwrite the CDATA label in JavaScript. This aspect of the validator is a lot of programmers, because the Web site tends to use embedded JavaScript for advertising and tracking scripts. If you have to use JavaScript, you can add the following tag to it:

Vii. image requires "alt" attribute

you may not have noticed that images are also a potential stumbling block to advanced authentication. In addition to the trailing slash, advanced validation requires an ALT tag to describe the image, such as alt= "Scary vampire picture", search engines also rely on ALT tags to identify the image on the page, so no matter how to add alt tag is always good.

Eight, unknown Entity data

Entity data is another easy-to-make error that affects validation. We can consider using the appropriate coded characters instead of the symbols "&". The appropriate encoded character entity data that is available in the XHTML section design is listed in the entire list.

Nine, bad nesting

Nesting is an element and an element, and we can easily confuse the order of nested elements. For example, start the strong tag before the DIV tag, but turn off the div tag first. This may not change the layout of the section, but it will invalidate the design of your section.

X. Missing "title" tag

Although this may seem like an obvious mistake, many programmers (myself included) often omit the title tag from the "Head" section. When you see "missing a required sub-element of head" (missing the necessary child elements of head), you will find yourself forgetting to add the title tag.

This article from the "11786697" blog, reproduced please contact the author!

10 common reasons why CSS is not valid in a DIV+CSS page layout

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.