In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "what is the reason why CSS is invalid in DIV+CSS page layout". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the reason why CSS is invalid in DIV+CSS page layout".
Ten common reasons for the invalidity of CSS in DIV+CSS page layout
We learn about DIV+CSS page layout from 52CSS.com, but W3Cvalidation is sometimes difficult to operate, but with it you can see the errors caused by layout. The validator throws a large number of errors and warnings indicating that your XHTML is not perfect and may not be consistent across browsers. The following ten minor failure problems have baffled a large number of programmers, and this article will show you how to solve them. Before the beginning of this article, I will introduce some issues that you should pay attention to when using W3C validators.
1. Don't worry about the validator's warnings: if the validator says 12 errors and 83 warnings, ignore it and move on to the next step.
2. Correct one error at a time: work in order, from top to bottom, one error at a time. HTML browses from top to bottom with a browser, and these errors are displayed in the same order.
3. Refresh the code every time you fix it to make it work again: a small mistake often leads to a series of errors throughout the page. Therefore, if you do not operate properly, "fix errors" may also lead to more errors. Make the code work again after each correction, which ensures that the problem is completely solved.
◆ is aware of the above basic exceptions, so let's take a look at several reasons why CSS is invalid in DIV+CSS layout.
1. The DIV tag is not closed
This is one of the most common causes of layout design failure. We are always surprised to learn that this is the main culprit for the failure of how many exquisite plate designs. The open DIV tag is one of the most common board design errors and one of the most difficult to diagnose. The validator sometimes points to the wrong opening of the DIV tag, making diagnosis as troublesome as looking for a needle in a haystack.
2. Troublesome embed tags
In the early 1990s, browsers for Microsoft and Netscape began to recognize non-standard unique fonts. Unfortunately, this means that the W3C validator does not recognize some key HTML tags, such as "embed", even if they are already widely used. If you really want strict DOCTYPE (document type) validation, you have to give up nesting.
If you want both effective layout and embedded media, you can try the FlashSatay approach.
III. Improper DOCTYPE statement
Not declaring DOCTYPE, or incorrectly declaring DOCTYPE at the beginning of the file, is also a common mistake. According to general experience, StrictDOCTYPE is the level of verification that everyone pursues. Strictvalidation shows that your web page can be displayed in all browsers. For declarations of DTD document types, you can refer to 52CSS.com 's related articles.
IV. End slash
If your site cannot be verified during DIV+CSS page layout, there is a good chance that you missed a trailing slash somewhere in the code. It's easy to ignore things like trailing slashes, especially in elements such as image tags.
This is not valid in strict DOCTYPE. To fix this problem, add "/" at the end of the img tag.
Ps: the same is true for input elements in the form using the "/" tag
5. Align tag
If DOCTYPE is set to Transitional, you will use the "align" tag, but if you are more demanding and want to be verified by Strict, you will see a lot of errors. Align is another tag that is not available for layout. You can try using "float" or "text-align" instead of align transformation elements.
VI. JavaScript
If you have declared StrictDOCTYPE, you need to override the CDATA tag in JavaScript. This aspect of the validator baffles many programmers because websites tend to use embedded JavaScript for advertising and tracking scripts. If you must use JavaScript, you can tag it with the following tag:
7. Image needs "alt" attribute.
You may not have noticed that DIV+CSS page layout images are also a potential stumbling block for advanced verification. In addition to the trailing slash, advanced verification also requires the use of alt tags to describe images, such as alt= "Scaryvampirepicture".
Search engines also rely on alt tags to identify images on web pages, so it's always good to add alt tags anyway.
VIII. Unknown entity data
Physical data is another error that can easily affect verification. We can consider replacing symbols such as "&" with appropriate coded characters. Entirelist lists the appropriate encoded character entity data that is available in the XHTML block design.
9. Bad nesting
Nesting means that elements are included in elements, and it is easy to confuse the order of nested elements. For example, start the strong tag before the DIV tag, but close the DIV tag first. This may not change the layout, but it will invalidate your design.
Lack of "title" tag
Although this may seem like an obvious mistake, many programmers (including myself) often leave out the title tag in the "head" section. When you see "missingarequiredsub-elementofHEAD" (missing the necessary child element of HEAD), you will realize that you have forgotten to add the title tag.
Thank you for your reading, the above is the content of "what is the reason why CSS is invalid in DIV+CSS page layout". After the study of this article, I believe you have a deeper understanding of what is the reason for the invalidity of CSS in DIV+CSS page layout. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.