首页 技术 正文
技术 2022年11月23日
0 收藏 784 点赞 4,010 浏览 1697 个字
<!DOCTYPE html>
<html lang="zh"><head>
<meta charset="UTF-8">
<title>rem phone test</title>
<meta name="viewport" content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<style>
html {
height: 100%;
width: 100%;
font-family: 'Heiti SC', 'Microsoft YaHei';
font-size: 20px;
overflow: hidden;
outline: 0;
-webkit-text-size-adjust:none;
}
body {
height: 100%;
margin: 0 auto;
overflow: auto;
-webkit-user-select: none;
position: relative;
}
header,footer {
width: 100%;
line-height: 1.5rem;
font-size: 1rem;
color: #000;
border: 1px solid #ccc;
text-align: center;
font-weight:bold;">#ccc;
}
.bd {
margin-top: 1rem;
margin-bottom: .5rem;
margin-right: -.5rem;
font-size: 0;
}
.box {
width: 5rem;
height: 5rem;
display: inline-block;
margin-right:0.5rem;
margin-bottom:0.5rem;
}
.blue-box {
font-weight:bold;
       background-color:red;
}
.org-box {
font-weight:bold;
    background-color:blue;
}
</style>
</head>
<body>
<header>我是头部</header>
<div class="bd">
<div class="box blue-box"></div>
<div class="box red-box"></div>
<div class="box blue-box"></div>
<div class="box red-box"></div>
<div class="box blue-box"></div>
<div class="box red-box"></div>
</div>
<footer>我是页脚</footer>
<script>
(function (doc, win) {
//获取根节点,将它赋值给一个变量
var docEl = doc.documentElement,
//利用三目运算来判断window中是否有这个事件,将它赋值给变量
//orientationchange()是改变窗口的方向
//resize()是计算窗口改变了多少次
resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
recalc = function () {
//获取可视区域的宽度
var clientWidth = docEl.clientWidth;
//进行判断是否要执行下面的换算
if (!clientWidth){
//0 undefined "" 都会返回false
return;
}
//进行单位的换算,通过窗口的变化,来进行根节点的单位变化
docEl.style.fontSize = 20 * (clientWidth / 320) + 'px';
};
if (!doc.addEventListener){
return;
}
win.addEventListener(resizeEvt, recalc, false);
doc.addEventListener('DOMContentLoaded', recalc, false);
})(document, window); //匿名函数的传参
</script>
</body></html>
上一篇: dynamic和object浅谈
下一篇: lua 和 c
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,022
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,513
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,359
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,142
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,773
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,851