<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>移动端基础模板快速创建</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<!-- 禁止缓存 开发时候使用 -->
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<link rel="stylesheet" href="">
<style>
/* css reset */
body,ul,ol,li,p,h1,h2,h3,h4,h5,h6,form,fieldset,table,td,img,div{margin:0;padding:0;}
html{ font-size: 40px; } /* 设置根元素 计算rem 1rem = 40px */
body{background:#fff;color:#333; font-family: PingFangSC-Semibold;}
ul,ol{list-style-type:none;}
select,input,select{vertical-align:middle; outline: none;}
img{vertical-align:middle; border:0;}
table { border-collapse:collapse; border-spacing:0; }
a{text-decoration:none;}
a:link{color:#009;}
a:visited{color:#800080;}
a:hover,a:active,a:focus{color:#c00;text-decoration:none;}
</style>
</head>
<body>
<!-- 固定的头部 fixed -->
<div class="header"></div>
<!--
body: overflow:hidden,
mainbox: overflow-y:auto; position:fixed; top:header.height(); bottom:footer.height(); left: 0; right: 0; width: 100%;
解决移动端滚动的时候固定的头尾会跟随浏览器移动的问题~
-->
<div class="mainbox"></div>
<!-- 固定的底部 fixed -->
<div class="footer"></div>
<script src="https://cdn.bootcss.com/jquery/1.12.1/jquery.min.js"></script>
<script>
$(function(){
setRem();
});
/**
* @Description: rem自适应
*/
function setRem(){
let b = document.documentElement,
a = function() {
let a = b.getBoundingClientRect().width;
b.style.fontSize = 0.0625 * (640 <= a ? 640 : a) + "px"; // 640*0.0625 = HTML的40px
},
c = null;
window.addEventListener("resize",function() {
clearTimeout(c);
c = setTimeout(a, 100);
});
a();
}
</script>
</body>
</html>
猜你喜欢
最新发布
github访问慢解决方法
2024-11-10 13:52:54
我TM终于找到工作了
2024-06-02 14:48:43
我TM服务器又被攻击了
2024-04-12 19:28:34
Jenkins使用http方式配置github项目
2024-03-19 18:10:08
CentOS安装Jenkins服务
2024-03-18 17:23:08
终于特喵的帮朋友把微信小程序第一阶段做完了
2024-03-03 19:21:25
2023年终总结
2023-12-20 21:30:52
CentOS7 安装Node.js v14
2023-11-16 09:57:36
npm 安装依赖报错 npm ERR | gyp verb
2023-08-23 15:08:39
electron-builder + vue 搭建桌面应用
2023-06-08 10:54:28