Coding Standards

  1. According to the HTML5 specification, the type attribute generally does not need to be specified when importing CSS and JavaScript files, because text/css and text/javascript are their default values ​​respectively
  2. Boolean properties can be declared without assignment. The XHTML specification requires it to be assigned a value, but the HTML5 specification does not
  3. For property values ​​or color parameters, omit leading 0s for decimals less than 1 (for example, .5 instead of 0.5; -.5px instead of -0.5px)
  4. Hexadecimal values ​​should be all lowercase, for example, #fff. Lowercase characters are easier to distinguish when scanning documents because their form is easier to distinguish
  5. Try to use shorthand hexadecimal values, e.g. #fff instead of #ffffff
  6. Avoid specifying units for 0 values, for example, use margin: 0; instead of margin: 0px;
  7. Related property declarations should be grouped together in the following order: Positioning | Box model | Typographic | Visua
  8. Compared with the <link> tag, the @import directive is much slower, not only adding extra requests, but also causing unforeseen problems
  9. Only lowercase characters and dashes can appear in class names

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325216295&siteId=291194637