Coding specifications for css and JS
This article is about the coding specifications of css and JavaScript. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.
1. Naming following the Protal-related css and JS coding specifications class requires the use of the project name plus "-" and specific naming. For example: jx-news-title. Try not to modify and override the default style of SharePoint
Other coding specifications need to follow the CSS coding specification.
Example:
/ Bad CSS / .selector, .selector-secondary, .selector [type=text] {padding:15px; margin:0px 0px 15px; background-color:rgba (0,0,0,0.5); box-shadow:0px 1px 2px # CCC,inset 0 1px 0 # FFFFFF}
/ Good CSS / .selector, .selector-secondary, .selector [type= "text"] {padding: 15px; margin-bottom: 15px; background-color: rgba; box-shadow: 0 1px 2px # ccc, inset 0 1px 0 # fff;}
two。 To consider the network delay, js and css need to be confused and compressed.
The original js and css can be used during development, but once provided to customers, js and css need to be confused and compressed, which can greatly reduce the size of javascript and css files. When the network delay is relatively large, the corresponding files can be loaded quickly.
On css and JS coding specifications to share here, I hope the above can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.