Open MrZWH opened 4 years ago
布局针对的是结构
3-1
npm i -g vorlon
vorlon
监听文件变动,自动刷新连接到页面的设备
npm i -g browser-sync
shift + 右键
可在当前目录下打开命令行
启动:
browser-sync start --server --files="css/*.css,*.html"
通过navigator.userAgent
var isMobile = navigator.userAgent.match(/android|iphone|ipad|ipod/i)
物理像素
物理像素(physical pixel)也可以叫做设备像素(dp:device pixel)
CSS 像素
CSS 像素也可以叫做逻辑像素(logical pixel),还可以叫做设备独立像素(dip:device independent pixel)
设备像素比
PPI
视口 viewport
width=device-width
与initial-scale=1
效果一样maximum-scale=1,minimum-scale=1
与user-scalable=no
效果一样获取视口 viewport 宽度:
不能用
screen.width
获取视口宽度,因为有兼容性问题,有时候会获得设备宽度获取 dpr:
window.devicePixelRatio
box-sizing
图标字体
flex 布局
容器的属性:
项目的属性:
媒体查询
媒体类型:
媒体查询中的逻辑:
媒体特征表达式:
媒体查询策略:
移动端常用单位