CSS Tutorial: CSS files should be kept neat and unified

Source: Internet
Author: User

A netizen has a headache problem. Need to be revised after several changes to the Web site, need to eliminate redundant code, in the CSS style re-engineering, more headaches, not only to the existing style of consolidation and streamlining, but also need to increase the skin function for the site.

It's not hard to see that this is a very frustrating job, facing a line of code scalp numbness. If we form good habits, it may make work easier. On this issue and experience, the following words may be of great reference value:

Using a link or import style sheet is a normal thing for a medium or high level CSS developer, but I'm still going to emphasize the importance of this approach here. Many of the sites I've seen, at the beginning of the site, the CSS files were neat and organized, but over time these documents became cluttered with inline and even inline (inline) styles, which may have been due to a short update period and perhaps sheer laziness.

You are busy with a large area update of a Web site with thousands of channels and you have a short deadline, so you've chosen to use a built-in or inline style for quick fixes. Some years later, the habit still ... until one day you are told that the site needs to be redesigned, but all the content remains unchanged at this time and you have only one weeks to complete. Imagine what a situation this would be.

In fact, this is a very common situation, updating the stylesheet is a simple task, after your years of "quick fix", these styles throughout the site, I believe you can not remember where they are. So now you're faced with only 2 choices: A, find a way to clean up these patterns within one weeks; B, find a new job.

Don't make your work more and more difficult. Using linking and importing style sheets is your choice. The specification is created and the style sheet is kept tidy, and you'll live a little easier.

Tip: Be careful to use a linked or imported method to add a redundant style to the tag. Every time you create a new style sheet, you update it or add new styles, and too much external style will not only make the fix difficult, but also make the stylesheet more difficult to maintain. So you can understand why large sites separate style sheets for different chunk parts. Be careful not to overdo it.

It is worth mentioning here that too many stylesheets will increase the number of HTTP requests. These will potentially affect performance. As a result, Internet Explorer restricts the number of linked style sheets to 32.

Please pay special attention to keeping CSS files neat and style consistent in actual work.

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.