10 common reasons why CSS is not valid in a DIV+CSS page layout
We learn div+css page layout knowledge, but brother even validation sometimes difficult to operate, but with it you can see the layout of errors caused by the design, validation program throws a lot of errors and warnings, your XHTML is not perfect, may not be able to maintain a consistent function on different browsers, The following 10 minor failure problems have baffled a large number of programmers, and this article tells you how to solve them. Before starting this article, I will introduce some of the issues that you need to be aware of when using the basic DIV+CSS validation program for your brother's PHP training.
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.
The above describes the Div+css layout div+css page layout of the 10 common reasons for the invalid CSS, including the div+css layout aspects, I hope that the PHP tutorial interested in a friend helpful.