How to organize style sheets in a div+css layout to facilitate simplification and maintenance

Source: Internet
Author: User
Tags split

For a simple Web site, you can use only one CSS file. For large, complex sites, it is a good practice to split style sheets to simplify maintenance. How to split a style sheet requires careful consideration. I usually use a CSS file to handle the basic layout and use another file to handle the layout and design decorations. In this way, after the layout is determined, there is little need to modify the layout style sheet. This prevents the layout style sheet from being accidentally altered or corrupted.

You can also subdivide further, such as using a separate CSS file to handle colors. In this case, if you want to provide a new color scheme, you just need to create a new color style sheet. If you have many forms on your site, you can use a separate CSS file to work with all form styles. You can link this file only when needed, reducing the initial download overhead. If some pages on a site are very different from the rest of the site, consider letting them use their own CSS files. For example, if the layout of the home page is very different from the rest of the site, you can create a separate CSS file for the home page.

Keep in mind that every CSS file means an extra call to the server. This can affect performance, so some developers prefer to use a large CSS file rather than multiple small files. The final choice actually depends on the actual situation, and to some extent it is a matter of personal preference. I tend to be as flexible and as easy to maintain as possible.



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.