美文网首页
自适应布局

自适应布局

作者: 致自己_cb38 | 来源:发表于2022-02-09 14:18 被阅读0次

一、布局单位

rem:相对于根元素的font-size(html)
em:相对于父元素
占满整个可视窗口
width:100vw
height:100vh

二、常用<meta>屏幕适配标签设置

https://www.jianshu.com/p/f61d77095568

<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="0">
<meta name="format-detection" content="telephone=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="viewport" content="initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
<!--移动端兼容适配 --> 
<script> 
// class 
! function( navigator ) { 
var userAgent = navigator.userAgent; 
documentElement = document.documentElement; 
if ( userAgent.match( /micromessenger\/5/gi ) ) { 
documentElement.className += " mobile wx_mobile wx_mobile_5"; 
} else if ( userAgent.match( /micromessenger/gi ) ) { 
documentElement.className += " mobile wx_mobile"; 
} else if ( userAgent.match( /ucbrowser/gi ) ) { 
documentElement.className += " mobile uc_mobile"; 
} else if ( /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test( userAgent.toLowerCase() ) ) { 
documentElement.className += " mobile"; 
} else if ( userAgent.toLowerCase().match( /msie/gi ) && ( parseFloat( userAgent.toLowerCase().match( /msie ([0-9]{1,}[\.0-9]{0,})/i )[1] || 999 ) < 9 ) ) { 
documentElement.className += " pc pc-ie pc-ie8"; 
} else if ( userAgent.toLowerCase().match( /msie/gi ) || navigator.msPointerEnabled || navigator.pointerEnabled ) { 
documentElement.className += " pc pc-ie"; 
} else { 
documentElement.className += " pc";  
} 
}( navigator ); 
// meta 
! function( userAgent ) { 
var screen_w = parseInt(window.screen.width), 
scale = screen_w / 640; 
if ( /Android (\d+\.\d+)/.test( userAgent ) ) { 
var version = parseFloat( RegExp.$1 ); 
document.write( version > 2.3 
? '<meta name="viewport" content="width=640, minimum-scale = ' + scale + ", maximum-scale = " + scale + ', target-densitydpi=device-dpi">' 
: '<meta name="viewport" content="width=640, target-densitydpi=device-dpi">' ); 
} else { 
document.write( '<meta name="viewport" content="width=640, user-scalable=no, target-densitydpi=device-dpi">' ); 
} 
}( navigator.userAgent ); 
</script> 
<!--移动端兼容适配 end -->

三、lib-flexible适配大屏方案

https://www.jianshu.com/p/7d1876a0222f
https://www.jianshu.com/p/79be33f2ce88
源文件下载:https://www.cnblogs.com/interdrp/p/9042749.html

相关文章

  • 2019-04-10响应式布局和自适应布局

    响应式布局和自适应布局详解 布局等于流动网格布局,而自适应布局等于使用固定分割点来进行布局。 自适应布局给了你更多...

  • 为iPhone 6设计自适应布局

    为iPhone 6设计自适应布局 为iPhone 6设计自适应布局

  • 常用网页布局

    一、多列布局 (1) 宽度自适应布局 两栏布局 左侧固定右侧自适应 右侧固定左侧自适应 技术原理(左侧固定右侧自适...

  • 常见网页布局的介绍

    左侧固定,右侧自适应 右侧固定,左侧自适应 圣杯布局(左右固定,中间自适应) 中间固定 两侧自适应 等分布局 等分...

  • 我还是要说的布局

    两栏布局 左边固定右边自适应 使用float布局 使用position布局    三栏布局 左右两边固定中间自适应...

  • Bootstrap 的日常使用

    十二栅格: 盒子的移动(不影响自适应布局): 元素的大小设置(不影响自适应布局):

  • 什么是响应式

    响应式 布局等于流动网格布局,而自适应布局等于使用固定分割点来进行布局。 自适应布局给了你更多设计的空间,因为你只...

  • 二栏布局一栏自适应和三栏布局中间自适应

    二栏布局一栏自适应 效果图: 三栏布局中间自适应 效果图:

  • 网页布局

    一、行布局 1.基础的行布局 2、行布局自适应 修改width为百分比: 3、行布局自适应限制最大宽 4、行布局垂...

  • css布局

    左边定宽,右边宽度自适应 等高自适应,两列布局

网友评论

      本文标题:自适应布局

      本文链接:https://www.haomeiwen.com/subject/wdvauhtx.html