I have summarized some CSS debugging experience!

Source: Internet
Author: User

The last time an artist worked on a project, he found that his style sheet could not be used. After a whole day, he could only write it in the style of tags. Later I found out that I was online and asked why. In fact, I have encountered such a problem before, but I have never summed up the reasons, it's just that I feel that something is wrong. I find the cause along with my thoughts. If the problem is solved, everything will be fine, No matter why!

In fact, the process for finding the cause is very simple, that is, from the top down, it is estimated that it is writtenProgramThe idea is always from top to bottom. However, this is quite useful. For example, the problem of finding a style sheet for the colleague above has all played a role.

Now let's talk about how to debug the style sheet last time:

First, I checked the page and asked her where she was wrong. I found the reason as described above.

Then I read over and over again the differences between writing styles in the style sheet and writing styles directly in the label. All these problems have persisted. Then I carefully read the style sheet she wrote, there should be no problem, except for some color valuesVs2008It is found to be invalid, and others are normal.

Finally, I am helpless. Let's go from top to bottom. Come on!

I first named the tag id , avoid class if it is not used, it is still unavailable.

In fact, what I previously thought was probably that she wrote class , then the parent label above contains id , class NO id the style effect cannot be displayed due to strong reasons, later I found that none of them id attribute.

Since the above practice is not good, it is time to come.

Then I am afraid that the style above her is wrong, and the style below cannot achieve the effect, I just entered ID Styles are stacked at the top of the style sheet on the Internet. In this case, my style has an effect, so the problem is obvious, that is, there are errors in the style below, no CSS That kind of thinking VS You cannot think about breakpoint debugging. JS Inside Alter Hey, hey, so I will just drag down the style I wrote a little bit. Of course, such a stack also requires some method. For example, it can be a big block, then find out which big part of the problem, and stack it in the big part by the small part method, so you can find it quickly.

Finally, I finally caught the problem, so I only need to look at the problem of this incorrect style. I want to see it carefully and find out the error. Haha!

Then the problem is:Font-family:Simhei, inVs2008Do not include double quotation marks,DWThis is not the case, but with double quotation marks removed, my style will have an effect. Remove double quotation marks.

Why ?......

In addition, I want to comment out the cause of the problem and find that there is no effect when writing a comment, so I didn't write a comment, but I used, so there are a lot of problems. It seems that writing style sheets requires good standards!

Happy New Year to colleagues!^-^Find Prince Charming

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.