长度rem的使用
2024-08-30 05:54:40
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="robots" content="all">
<meta name="format-detection" content="telephone=no" />
<style type="text/css">
*{padding: 0;margin: 0;}
html,body{width:100%;height: 100%;font-family: "Microsoft YaHei"; position: relative;}
.banner{height:230px;width: 414px;background: red}
</style>
<script type="text/javascript"> //var num=$(window).width();
var num= window.innerWidth;
var font=num/10;
document.getElementsByTagName('html')[0].style.fontSize=font+'px'
//$('html').css('font-size',font+'px');
/* window.onresize=function(){
num=$(window).width();
font=num/10;
$('html').css('font-size',font+'px');
} */
</script>
<title>平台</title>
</head>
<body>
<div class="banner">
</div>
<script type="text/javascript">
var html=$('html').html();
var remhtml=html.replace(/(\d+)px/g, function(a,b){
console.log(b)
var num=b/41.4+"";
console.log(num)
return num.substring(0, 5)+"rem";
})
console.log(remhtml);
</script>
</body>
</html>
最新文章
- Python>;>;>;使用Python和Pygame创建画板
- FineReport层式报表解决大数据集展示问题攻略
- make:cc 命令未找到的解决方法
- 【原创】Silverlight客户端发起WebRequest请求分析
- poj 1087 最大流
- 如何通过源码生成Gatling可执行工具
- python下载时报错 Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time
- 实验楼-4-Linux文件权限
- codeforces 887A Div. 64 思维 模拟
- [BJOI2019] 光线
- 剑指offer数组3
- 开源项目商业模式分析(2) - 持续维护的重要性 - Selenium和WatiN
- 如何配置Java环境变量[转]
- 利用springloaded进行java jar&;class的动态替换
- 第一次Spring总结
- day6 六、元组、字典、集合的基本操作和内置方法
- Memcached使用与纠错(附代码和相关dll)
- Linux yum源详解
- SQL Server中float转字符串进度丢失
- thinkCMF----如何写标签