As we all know, standard css naming can enhance the readability of style rules, so that you or others can modify the page later. At first, when I wrote css rules, I used Chinese abbreviations to name them. Now it seems very unprofessional, and it also wastes my energy for later maintenance.
According to my own writing habits and some online writing methods, I have summarized a set of id naming methods for myself.
Common names of CSS classes and IDs:
Website header: head/header (head) top (top)
Navigation: nanv navigation: topnav (top navigation), mainnav (main navigation), mininav (mini navigation), textnav (navigation text), and subnav (subnavigation/secondary navigation)
Banners, advertisements, and trademarks: logo, brand, and banner)
Search: sreach, sreachbox, sreachbtn, and sreachinput)
Registration and logon: login, regsiter, userbox, and password)
Layout, bigdiv, leftdiv, rightdiv, leftfloat, and rightfloat), mainbox (), subpage (subpage/second-level page)
Footer/bottom: foot/footer (footer/bottom), copyright (copyright information), sitemap (website map)
Others: content, skin, title, from, pic, news, and shop), list (list/list), newslist (News list), downloadlist (download list), piclist (Picture list), dropmenv (drop-down menu), cor/corner (rounded corner), homepage (home page), crumb (current location navigation)
In fact, I often use case and _ to distinguish the above id names. For example, the main navigation is MainNav, and if necessary, the main navigation is MainNav_1 and MainNav_2. You can also use the "type + variable name" rule for naming. For example, to write a class in red, you can use. f_red {} (f is the abbreviation of font ). The general principle is: Case, _, abbreviation, greatly enhancing the readability of the Code.
In addition, I often use the "in" method to name the sub-divd AND THE in + parent div, so that the div after the previous name does not know how to name it. Such as intop, inbox, infrom, and inlogin.
There is no really standard naming convention, and everyone has their own writing. However, we should try to rely on the specifications that everyone agrees with. After all, this has great benefits in teamwork.