DISCUZX System CSS Coding specification, CSS attribute writing order

Source: Internet
Author: User

1. Attributes are written on a single line, there must be spaces between attributes, property names and values, and between attributes and "{}", for example:. class {width:400px; height:300px;}

2. The writing order of the attributes:

2.1. According to the element model from the outside and inside, from the whole to the details of writing, roughly divided into five groups:

Location: position,left,right,float

Box Model properties: Display,margin,padding,width,height

Borders and Backgrounds: border,background

Paragraphs and texts: Line-height,text-indent,font,color,text-decoration,...

Additional properties: Overflow,cursor,visibility,...

2.2. Properties for special browsers should be written before the standard properties, such as:-webkit-box-shadow:; -moz-box-shadow:; Box-shaow:;

3. Be cautious about adding new selector rules, especially not abusing IDs, inheriting and reusing existing styles as much as possible

4. Selectors, attributes, and values are lowercase (except for the color values in the format), and the abbreviated selector name must describe the full name of the abbreviation, for example. CL-> Clearfix

5. Avoid using a variety of CSS Hack, if you need to make a special definition of IE, see the following section "on the CSS Hack description"

6. Do not use redundant and inefficient CSS, such as:

UL Li a span {...}

7. Use!important carefully

8. Suggested use of the words in the class/id name

6.1. State of presentation: a->active

6.2. Presentation structure: H->header,c->content,f->footer

6.3. Expression area: Mn->main,sd->side,nv-navigation,mu->menu

6.4. Presentation style: L-list,tab,p_pop

9. The outstanding matters in the development process shall be marked with [!] for subsequent discussion and collation.

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.