标签:屏幕宽度 cti 实现 目的 tor class width asc text
1.首先需要看设计稿是多少(750px),根据设计稿在设置rem,也就是设置html的字体大小,25*30=750
<!-- 在HTML开头就引入动态获取屏幕宽度 -->
<!-- rem实现适配 -->
    <script type="text/javascript">
        // 页面打开 立即计算
        document.querySelector(‘html‘).style.fontSize = window.screen.width / 25 + ‘px‘;
        // 尺寸更改也会重新计算
        // 这里 写这个事件的目的是 是为了 让我们在 桌面端测试时 可以自动计算 移动端
        window.onresize = function() {
            document.querySelector(‘html‘).style.fontSize = window.screen.width / 25 + ‘px‘;
        }
    </script>
在scss文件中设置rem
  @function p2r($size) {
  @return ($size/30) *1rem;
  }
标签:屏幕宽度 cti 实现 目的 tor class width asc text
原文地址:http://www.cnblogs.com/wade1220/p/7608526.html