Rules for style naming when writing CSS code

Source: Internet
Author: User
Tags lowercase

What to note:

First, the name of the selected word should choose not too specific to express a certain state (such as color, size, etc.) words, to avoid when the state changes when the names lose meaning.

Second, the style class name consists of a lowercase letter (A-Z), a number (0-9), an underscore (_), a minus sign (-) that starts with a letter.

The ID name consists of a lowercase letter (A-Z), a number (0-9), and an underscore (_) that does not begin with a number.

You can use a rule similar to the following:

[Module Prefix | type | function]_[name]_[status | location]

The words or abbreviations used by the contract module, type, state, position, etc. are kept in the order above, as far as possible to maintain the use of two to three words.

Cases:

General noun abbreviation

Setting set

Success SUC

Hint hint

Operation op

Password pw

Menus Menu

Button BT

Text TX

Color C

Background bg

Border Bor

Center Center

Icons icon

Pop Pop

Text input box. Input_tx

Password input box. INPUT_PW

Login password input box. input_pw_login

Log setup success prompt. Hint_suc_blogset

Album pop-up settings layer. Pop_set_photo

Public hints. HINT_BG

Text color. C_tx

Paragraph text color. c_tx_p

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.