加上如下js,px转换成rem需要手动,计算方式:量的大小除以100,就等于rem,例如:量的设计稿元素宽度是120,那么就写成{width: 1.2rem},这样写有什么问题,待研究,也欢迎补充

<!DOCTYPE html>
<html lang="en" style="font-size:100px">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script>
function resetFontSize() {
var baseFontSize = 100
var designWidth = 750
var width = window.innerWidth
var currentFontSize = (width / designWidth) * baseFontSize
document.getElementsByTagName('html')[0].style.fontSize = currentFontSize + 'px'
}
window.onresize = function () {
resetFontSize()
};
resetFontSize()
</script>
<style>
*{
padding:0;
margin:0;
}
body{
overflow: auto;
font-size: .28rem;
}
.box{
width:7.5rem;
height: 1rem;
background: #000;
} </style>
</head>
<body>
<div class="box"></div>
<p>42341</p> </body>
</html>

最新文章

  1. 2.用vs2015创建Dotnet Core的mvc项目
  2. Metronic 与 VS2013/2015 合作开发
  3. golang level
  4. WCF配置详解
  5. hdu 1527(威佐夫博奕)
  6. 四核网络机顶盒芯片局势分析(开放市场):rk3128将会成为四核主流
  7. hdu_5683_zxa and xor(非正解的暴力)
  8. Android中购物车的全选、反选、问题和计算价格
  9. Swing-GridBagLayout用法-入门
  10. python判断素数的方法
  11. Android--UI之ImageView
  12. mysql高性能6章总结(下) mysql查询优化
  13. 前后台分离开发--文件上传与下载,cookie,session
  14. Check the NativeLink log file
  15. java几个easy出错的小程序
  16. 解决Shiro+SpringBoot自定义Filter不生效问题
  17. maven私服的搭建
  18. PHP FTP函数
  19. UML概述
  20. 一 web爬虫,requests请求

热门文章

  1. Python轻量级开发工具Genay使用
  2. linux 之 pthread_create 实现类的成员函数做参数
  3. list元素按照日期排序
  4. 2017年内容营销如何提高ROI转化率
  5. ElementTree 无法处理中文
  6. pyqt5-实时刷新页面(QApplication.processEvents())
  7. shell脚本安装python、pip--这种写法是错误的---每一个命令执行完都要判断是否执行成功,否则无法进行下一步
  8. npm scripts
  9. python基础知识(字符串)
  10. 流程控制,循环结构,for,while循环