Adaptive finishing of mobile terminals

Source: Internet
Author: User

First, the mobile side adaptation

Method One: Viewport adaptive screen width

Create META tags in HTML: The width of the page is equal to the width of the screen.

<meta name= "viewport" content= "Width=device-width, initial-scale=1,user-scalable=0" >

Method Two: Frame construction page

      1. Bootstrap jquery-based response tool for mobile, PC, pad, etc.
      2. Elementui (PC-side), Mintui (mobile) based on Vue component library development

Second, the mobile side problem

  (1), 1px frame

Method one: Pseudo-element + transform implementation

. scale-1px{  position:relative;}. scale-1px::after{  content: ";  Position:absolute;  bottom:0;  left:0;  right:0;
border:1px solid red; Transform:scaley (0.5);}

Method Two: View + REM Implementation

  

(2), Mobile side layout mode

Method One: Responsive layout

Streaming layouts + Media queries

Method Two: Flexible layout

Flexbox

Method Three: REM layout

      

<!DOCTYPE HTML><HTML>    <Head>        <MetaCharSet= "UTF-8">        <title></title>           <!--Mobile Port configuration + REM settings: Inline JS recommended -        <Script>            //set the palatability and scale to achieve pixel 1:1 restore            varratio= 1 /(Window.devicepixelratio||1); //window.devicepixelratio: The pixel ratio of the browser. document.write ('<meta name= "viewport" content= "width=device-width,initial-scale='+ratio+', minimum-scale='+ratio+', maximum-scale='+ratio+', User-scalable=no "/>')            //Set HTML font size            varsize=Document.documentElement.clientWidth/7.5;//calculated in 750 dimensions            //The font-size of HTML to be set is 100px, which is 1remdocument.getElementsByTagName ('HTML')[0].style.fontsize=size+ 'px'; </Script>    </Head>    <Body>code ...</Body></HTML>    

Adaptive finishing of mobile terminals

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.