CSS Writing style

Source: Internet
Author: User
Tags class definition
This format is self-developed by me. I am often asked why. Here is a simple summary:
1. Classification. A module or similar function is defined as a class definition, which is separated by paragraphs.
2. Classification: each definition statement in each type of definition uses Tab indentation for vertical alignment based on the structure or semantic level.
3. split, each attribute definition in each definition is separated by a semicolon + Space. Note that there is no space between the definition statement and the semicolon, "{}" contains spaces before and without spaces.
4. The row is connected. Each definition is always horizontal without line breaks. Some editors will automatically wrap the line, but there is no major impact. After all, there are a few very long definition statements.
I understand the advantages of the following: first, the program structure is clear and easy to read, and it will not be dazzled, but the second is to maximize the use of space. More definitions can be displayed on the screen, this improves development efficiency. It is more convenient to press enter and space. Of course, if you need to do better, you must add reasonable comments.
Some people doubt that such writing may result in too crowded and difficult reading. This kind of drawback is obvious, but in practice, the situation that a large area of complex statements are stacked together conflicts with the essence of CSS definition. As long as optimization is done, this situation will be rare.
In addition, some editors can also avoid these problems. For example, UltraEdit has a horizontal operation area prompt, which is used to replace notepad for quick editing.
The question of the benevolent and wise lies in the development environment that you are used. For your 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.