1. rem 基础 rem 是一个相对单位,类似于 em ,em 是父元素字体大小. em 是相对于父元素 的字体大小来说的 rem 是相对于 html 元素 字体大小来说的 rem 优点 就是可以通过修改 html 里面的文字大小来改变页面中元素的大小可以整体控制 比如:根元素(html )设置的 font-size=12px:非根元素设置 width:2rem:则换成px 表示 24px(12px*2rem) 2. 媒体查询(@media) @media 可以针对不同的屏幕尺寸设置不同的样…
(function(designWidth, maxWidth) { var doc = document, win = window; var docEl = doc.documentElement; var tid; var rootItem,rootStyle; function refreshRem() { var width = docEl.getBoundingClientRect().width; if (!maxWidth) { maxWidth = 540; }; if (wi…
html { font-size : 20px; } @media only screen and (min-width: 401px){ html { font-size: 25px !important; } } @media only screen and (min-width: 428px){ html { font-size: 26.75px !important; } } @media only screen and (min-width: 481px){ html { font-s…