CSS specification and modularity

Source: Internet
Author: User

I. Document specification

1. Files are archived according to common class and business class

2. Files are introduced using outreach, and some other styles are introduced using inline


3. The file name is in lowercase letters, can be appropriately underlined, and then use numbers to represent the version
4. Encoding in UTF-8 format

II. specification of annotations

1. Block annotations: Uniform indentation, above the annotated object

2. Single-line comment: Text ends with spaces on top of the annotated object

3. In-line comment: Text ends with spaces, after semicolons

Third, naming norms

1. Named by category, the layout class starts with G and the actual content starts with M

2. The name is readable and the length is moderate, the appropriate abbreviation

3. Semantic naming methods

Iv. Code of writing

1. Multi-line writing for easy reading

2. Default indent is four spaces

A space within the 3.CSS rule

4. Semicolons that need to retain the last property value

5. Attribute writing order according to: Position Property--Self box model related properties--display the order of the attributes to write

6. Use Hack,ie6 as little as possible, ie67 start with *, write ie67 First, then write IE6

7.color named with 16 binary, and as far as possible abbreviated

8.url () file format without quotation marks

V. OTHER SPECIFICATIONS

1.<! DOCTYPE html> Shelf Start document declaration

2. Closed labels are closed, self-closing labels are not closed

3. Attributes are quoted in single quotes, ReadOnly, checked and other attributes can be written directly without = ""

4. Use indentation to reflect the level, correct nesting, but not too deep, affecting performance

5. Note:<!--A--xxx <!--/A---

6. Label properties are lowercase

7. The file is semantically named and cannot be too long

8. Keep Source Files

9. Use sprite technology to merge pictures

10. Image according to module, business, page to divide


The benefits of modularity

1. Facilitates collaborative development of multiple people

2. Easy to extend and reuse

3. Readability, maintainability is good

4. Does not cause style pollution

CSS specification and modularity

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.