Notes for css

Source: Internet
Author: User
Tags comments

The special articles in "website design comments" can be reproduced at will. For reprinting, please note: "Source: Blue ideal author: Xiaoyi"
The website design comments prepared by Xiaoyi are shared files provided to all netizens on the Internet. No organization or individual may use this topic article for commercial purposes for any reason.
Optional -------------------------------------------------------------------------------------------------------------------*/


In the article "setting up your own operating standards", I pointed out that the main way to speed up development is to reduce repetitive work.

Today's topic is also some preliminary work to reduce repetitive work.


Note that the ID name cannot contain Style words. For example, the ID of a DIV such as # divBlue

It indicates that my DIV is blue, but if the background is blue and the text is red or yellow, this DIV

The ID of is difficult to be representative. In the long run, we want to make this DIV green during the revision.

An ID is an error!


Of course, do you mean that the name of the CLASS can be a style with a clip? The CLASS needs to be viewed relatively! For example

Some specific style CLASS names must be recognized by style-related words. For example, we can create

". TextRed {color: # f00;}", because we need to use this CLASS to define it in some specific places.

The text is red. Of course, this CLASS is rarely used!


What is the correct name? By function. For example, the "navigation bar" is named "nav".

In what style is used, the navigation bar will not change in essence. What if the navigation bar is multi-level? Sub-level

The name is "navChild" or "childnv". I personally advocate that "navChild" is in line with the Chinese thinking logic. So

What about the child layer? Name it navChildChild or nav2Child ". It is usually hard for us to encounter more than three

Navigation bar of the layer! There is another situation: when every option in the navigation is different, you need to set different IDs and

What should I do if it is not a CLASS? In this case, we cannot add a number to each ID and need the name of this option,

For example, # navMusic indicates the ID of the music option in the navigation bar.


Everyone noticed this! I always name the first letter of the second word in upper case. This helps us to read and understand it.

. In addition, the parent name must be added to indicate the inheritance relationship of this ID.


As you know, Chinese characters are not supported in WEB tags, so you choose to use English or pinyin.

Look at your preferences! The key is to form your own standards, so that you will find that your code is very close to you.

 

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.