How to plan and organize a good style sheet

Source: Internet
Author: User

How to Create a high-quality html page, the most important one is the style sheet, in addition to the style sheet, there are other factors, such as the minimum Page code volume, the minimum page request resources, for example, high-quality JS code can be used to open another topic. I personally propose a discussion draft for CSS organizations:

1. Define a common.css for global definition and definition of some common components, such as general layout, grid, header, banner, bottom, popwindow, dialoge, and other pages;

2. Each module defines a css file for all definitions of this module. The modules are divided as follows: home, info, and news), website Special Services (??) , Message board (bbs), login to register personal center merchant information (user), some content may be cross, for example, the seller information will have a style of information, do not cross reference, A small number of repeated definitions are allowed;

3. For details about the class name, refer to: csscommon naming convention and detailed description of .doc (baidu). We recommend that you name it by "module name_element type_function", such as home_table_nav and home_div_nav; general styles can be named in the format of grid_table_nav;

4. Try to use # ID and use cascade filtering to define the style. This reduces the number of class names written in HTML, in addition, we recommend that you use the preceding methods to unify the ID names, such as tblXXX, divXXX, and ulXXX;

5. Strictly prohibit pinyin letters or abbreviations. For example, xxfb stands for "information publishing", which is hard to understand;

6. If there are no special cases, it is not recommended to write style definitions directly in jsp or to write styles directly to elements. If the page needs to be left blank, for example, you can create a style file dedicated to the current page;

7. Install plug-in Dust-Me Selectors http://www.brothercake.com/dustmeselectors/ for style sheet check cleanup, clear unnecessary definitions;

8. We recommend that you use css sprite to define the background image involved in the style sheet to reduce the number of image requests. You can consider dividing the image by style file, A style file corresponds to a background image;

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.