Trying to standardize CSS code

Source: Internet
Author: User

1. Module segmentation, with the following annotations to remind you of the role of CSS code;
/*-------------*/*---------->>> GLOBAL <<<-----------*/*----------*/

A sample Format I try to stick to are this:

Global styles– (body, paragraphs, lists, etc)
Header
Page Structure
Headings
Text Styles
Navigation
Forms
Comments
Extras

2. Unified management of code

For example:
1). title
H2 {}

#snapshot_box H2 {
padding:0 0 6px 0; }

#main_box H2 {
Color: #e2e2e2; }

. sidetagselection H2 {
Color: #fff;
Font:bold 14px/14px "Verdana", Sans-serif; }

You'll be able to style each one independently and isn't worry about child classes inheriting attributes from the parent CLA Ss.

3. Use shorthand
Example: margin:0px 1px 0 0;
4. Importance of the use of the head style; important;
If you know this all of the H2 ' s would not have a margin or padding, define that on the top level and let it effect CASCAD e as it is supposed to.

Trying to standardize CSS code

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.