H5 learning, h5 learning tutorial

Source: Internet
Author: User

H5 learning, h5 learning tutorial

1. html {font-size: 62.5%;} // The reason for not having to use font-size: 10px: (After setting 62.5%, there will be1rem = 10pxIt is easy to use rem to specify the size of the element. In this way, the font-size can be changed directly in the response mode without the need to calculate the size of the elements in other styles. Another advantage of defining the size with rem is that it is better suited to scaling/browser setting of the font size (because rem changes synchronously relative to the font size ).

As for the reason for choosing 62.5% rather than 10px, the main reason is the comprehensive consideration of compatibility and future development trends. The meaning of the unit of px has become increasingly confusing, it is almost impossible to assess whether devices will always be compatible with px on the web page as they are now, or to make px return to the original meaning of "pixel, but 62.5% represents the default font size of 62.5%, which is basically not confusing-derived from the https://segmentfault.com/q/1010000002411895

)

2. Percentage of width

3. rem can be used for height

4. It is best not to use display:-webkit-box for float;

. Box {
/* Display */
Display:-webkit-box;
Display:-moz-box;
Display:-ms-flexbox;
Display:-o-box;
Display: box;

/* Box-orient */
/**
* Vertical column
* Horizontal row
*/
-Webkit-box-orient: vertical;
-Moz-box-orient: vertical;
-Ms-flex-direction: column;
-O-box-orient: vertical;
Box-orient: vertical;

/* Box-flex */
-Webkit-box-flex: 1;
-Moz-box-flex: 1;
-Ms-flex: 1;
-O-box-flex: 1;
Box-flex: 1;

/* Box-pack */
-Webkit-box-pack: justify;
-Moz-box-pack: justify;
-Ms-flex-pack: justify;
-O-box-pack: justify;
Box-pack: justify;

/* Box-align */
-Webkit-box-align: justify;
-Moz-box-align: justify;
-Ms-flex-align: justify;
-O-box-align: justify;
Box-align: justify;
}

 

5. Like the PC end, js in H5 should also be written in window. onload (function () {}) or $ (function () {}).

Related Article

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.