In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Today, I will talk to you about the ten common reasons why CSS is invalid in the layout of DIV+CSS pages. Many people may not know much about it. In order to make you understand better, the editor summarized the following content for you. I hope you can get something according to this article.
When we validate the finished page with W3C validation, the validator throws a large number of errors and warnings indicating that your XHTML is not perfect and may not be able to maintain consistent functionality on different browsers. The following ten minor failure problems baffle a large number of programmers, and the editor will tell you how to solve them. Before you begin, I will introduce some issues that you should pay attention to when using the W3C validator.
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.
Knowing the above basic anomalies, let's take a look at several reasons why the layout is ineffective.
1. The p 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 p 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 open p tag, which is 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 Flash Satay 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, Strict DOCTYPE is the highest level of verification that everyone pursues. Strict validation shows that your web page can be best 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 can't be verified, there's a good chance 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.
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 Strict DOCTYPE, 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.
7. Image needs "alt" attribute.
As you may not have noticed, 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= "Scary vampire picture". 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. Entire list 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 p tag, but close the p 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 "missing a required sub-element of HEAD" (missing the necessary child element of HEAD), you will realize that you have forgotten to add the title tag.
After reading the above, do you have any further understanding of the ten common reasons why CSS is invalid in DIV+CSS page layout? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
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.