• 移动端rem布局的适配mixin【转藏】


    /*================================================================
    以下为基于ip5 宽度320做的适配,标准html{font-size:10px},即1rem = 10px
    =================================================================*/
    @mixin queryWidth($min, $max) {
      @if $min == -1 {
        @media screen and (max- $max+px) {
          html {
            font-size: ( ($max+1) / 320 ) * 10px;
          }
        }
      } @else if $max == -1 {
        @media screen and (min- $min+px) {
          html {
            font-size: ( $min / 320 ) * 10px;
          }
        }
      } @else {
        @media screen and (min- $min+px) and (max- $max+px) {
          html {
            font-size: ( $min / 320 ) * 10px;
          }
        }
      }
    }
    
    @media only screen and (orientation: landscape) {
      html {
        font-size: 10px;
      }
    }
    
    @include queryWidth(-1, 319);    // for iphone 4
    @include queryWidth(320, 359);   // for iphone 5
    @include queryWidth(360, 374);
    @include queryWidth(375, 383);   // for iphone 6
    @include queryWidth(384, 399);
    @include queryWidth(400, 413);
    @include queryWidth(414, -1);    // for iphone 6 plus

    以上为基于320的设计稿,若要基于375,只需将mixin中320改为375即可。若要100px=1rem,只需将mixin中10改成100即可。当然,这只能实现大部分常规机型的适配,有些特殊机型还是需要自己再加上对应的适配。

      接下来罗列一下我用到过的适配,希望得到各位帮助逐步完善。

    @media screen and (min- 320px) {} //for iphone 5
    @media screen and (min- 375px) {} //for iphone 6
    @media screen and (min- 414px) {} //for iphone 6 plus
    @media screen and (min-aspect-ratio: 69/100) {} //for huawei荣耀6
    @media screen and (min-aspect-ratio: 7/10) {} //for mx3
    @media screen and (max-height: 480px) {} //for iphone 4
    @media screen and (max-height: 420px) {} //for iphone 4 微信
    @media only screen and (orientation: landscape) {} // for 横屏

    原文地址:http://www.cnblogs.com/McChen/p/5017120.html

    @media (min-320px) and (min-height:480px) {
        .code{top: 42vh!important;}
     }
     
     @media (min-320px) and (min-height:568px) {
        .code{top: 32vh!important;}
     }
  • 相关阅读:
    2.monkey的使用
    1.monkey的安装及环境配置
    3.SQL注入系列二
    2.SQL注入系列一
    1.Appscan工具的使用
    二十二.jmeter的架构和loadrunner原理一样,都是通过中间代理,监控和收集并发客户端发出的指令,把他们生成脚本,再发送到应用服务器,再监控服务器反馈结果
    二十一.HTTP属性管理
    二十. StringFromFile与counter函数
    十九.jmeter函数---csvRead( )
    十八.jmete java工程测试
  • 原文地址:https://www.cnblogs.com/zxyun/p/5069725.html
Copyright © 2020-2023  润新知