CSS selector naming and common naming
CSS selector naming and common namingSpecification naming is also an important part of the Web Standard, the standard naming can make the code more readable, and conducive to search engines, such as the definition of two Div, an id named "Div1", the other named "News", is certainly the second more readable, and the search engine crawl rate is higher, In the team work can also greatly improve the efficiency. In order to achieve this effect we need to normalize naming (semantic naming)! To say a digression, normalized named code, will significantly you more professional! About CSS naming law, and other programs named almost, there are three kinds: camel nomenclature, Pascal Nomenclature, Hungarian nomenclature. Look at their names is very difficult to understand, do not be frightened, in fact, very easy, do not believe the words continue to look down ~
"Camel name Law"When it comes to camels, we must think of its obvious characteristics, the uplift of the back, a low, and our name also to such a low, how to do so, with the size of the letter Bai ~, capital of English is equivalent to the camel back of the bulge, the lower case is concave place, but this also has rules, is the first letter to lowercase, the first letter of the following words will be capitalized, as follows: #headerBlock If there are words after the second word? That's the case. Navmenuredbutton that is, no matter how many words come together, the first letter of all the words in the back is capitalized.
"Pascal's name Law"The nomenclature is also a mixed case of uppercase and lowercase letters, and Camel name method is very similar, but with the camel name method is a little different, that is, all the words are capitalized, of course, including the first word, as follows: #HeaderBlock. Navmenuredbutton, if the "Camel name Law" is for a dromedary words, then "Pascal name Law" is the Bactrian camel ~
"Hungarian nomenclature"The Hungarian nomenclature is to prefix the name with one or more lowercase letters to make the name more recognizable and easier to understand, such as: #head_navigation. Red_navmenubutton above three species, the first two (Camel name law, Pascal nomenclature) is commonly used when naming CSS selectors, of course, the three kinds of nomenclature can be mixed use, another need to adhere to a principle of "easy to understand, easy to work together" OK, or "even if people do not understand the code to see the code also know what the role of", there is no need to emphasize the kind of naming law, You can use it according to your preferences.
Common naming of page modules
Head: Header |
Navigation: Nav |
Menus: Menu |
Links: Friendlink |
Page Envelope: Wrapper |
Sub-navigation: Subnav |
Sub-menu: submenu |
Download: Download |
Page body: Main |
Ad: Banner |
Sidebar: Sidebar |
Tip: Tips |
Contents: Content |
Logo: Logo |
Column: Column |
Scrolling: Scroll |
Footer: Footer |
Searches: Search |
Hotspot: Hot |
Previous: Prev |
Copyrights: Copyright |
Login Strip: Loginbar |
Press: News |
Next: Next |
CSS selector naming and common naming