Code specification, java code specification

Source: Internet
Author: User

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:

    1. Positioning
    2. Box model
    3. Typographic
    4. 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;}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.