Code specification, java code specification
HTML syntax
- Use two spaces to replace tabs-this is the only way to ensure consistent display in all environments.
- The nested element should be indented once (that is, two spaces ).
- For attribute definitions, make sure that all double quotation marks are used. Do not use single quotation marks.
- Do not add a slash to the end of the self-closing element-this is optional in the HTML5 specification.
- Do not omit the optional ending tag (for example,
</li>Or</body>)
- Introduce CSS and JavaScript files
According to HTML5 specifications, when introducing CSS and JavaScript files, you do not need to specifytypeAttribute, becausetext/cssAndtext/javascriptThey are their default values.
- Declaration Order
The relevant attribute Declaration should be a group and arranged in the following order:
- Positioning
- Box model
- Typographic
- Visual
Positioning can remove elements from normal document streams and overwrite box model styles. The box model ranks second because it determines the size and position of the component.
Other attributes only affect the components.Internal (inside)Or does not affect the first two groups of attributes, so they are placed behind.
.declaration-order { /* Positioning */ position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 100; /* Box-model */ display: block; float: right; width: 100px; height: 100px; /* Typography */ font: normal 13px "Helvetica Neue", sans-serif; line-height: 1.5; color: #333; text-align: center; /* Visual */ background-color: #f5f5f5; border: 1px solid #e5e5e5; border-radius: 3px; /* Misc */ opacity: 1;}