Web Standard learning: CSS style writing style

Source: Internet
Author: User
Tags definition class definition

This format is my own creation, often someone asked me why, here to make a simple summary:

1. Classification, a module or similar function is defined as a class of definitions, separated by paragraphs between each type of definition.
2. Ratings, each defined statement in each class definition, is vertically aligned using tab indentation according to the structure or semantic level.
3. Break, each definition within the definition of each attribute, separated by "semicolon + space", note that there is no space between the definition statement and the semicolon, "{}" there are spaces before the space and then no spaces.
4. Even row, each definition does not wrap, has been horizontal. Some editors will automatically wrap, but there is no big impact, after all, the definition of the statement is very long is a minority.

  

My own understanding of the advantages of: first, the program structure is clear and easy to read, not dazzling and affect play; the second is to maximize the use of space, a screen to show more definitions, improve the development efficiency, knocking carriage and space is of course more convenient space. Of course, if you need to do better, you have to add a reasonable annotation.

Some people doubt that writing may be too crowded, but horizontal reading is difficult. The drawbacks are obvious, but in practice, large areas of complex statements piled together and CSS definition of the essence of the conflict, as long as the optimization of the home, this situation will be very small.

Some editors can also avoid these problems, such as UltraEdit has a horizontal operation area hint, which is useful in lieu of Notepad for quick editing.

  

The question of the beholder, which has a lot to do with the development environment that you are accustomed to. Personal humble opinion, for reference only.



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.