CSS Page Self-adapting

Source: Internet
Author: User

First, add <meta name= "viewport" content= "width=device-width,initial-scale=1.0 in <meta charset= "UTF-8" > (Set page encoding)   <meta http-equiv= "Pragma" content= "No-cache"/>   (not allowed to read from the cache, cannot be accessed offline) two, the introduction of CSS method one: Depending on the screen width loading different css <link rel= "stylesheet" type= "Text/css"media= "screen and (max-device-width:640px)"href= "Small.css"/>This means: The screen width is maximum 640px, load small.css <link rel= "stylesheet" type= "Text/css" media= "screens and (min-width:640px) and (max-    device-width:960px) "href=" Middle.css "/> means: screen width between 640~960px, load Middle.css method Two: Add @media in the same CSS to judge less in the notation:      p{font-size:16px;      @media screen and (max-device-width:640px) {font-size:14px;    }} CSS in the wording: p{font-size:16px;      } @media screen and (max-device-width:640px) {p{padding-top:45px; }} Note: 1, do not use absolute width: width:xxx px;, can use EM or% instead, the same font 2, the appropriate use of absolute layout absolute, but do not misuse 3, the proposed use of mobile layout float (more details, refer to Http://luso ngsong.com/info/post/158.html)

CSS Page Self-adapting

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.