HTML移动端单位
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<style type="text/css">
*{
margin: 0px;
padding: 0px;
}
#top{
position: absolute;
top:0;
height: 20%;
background: blue;
text-align: center;
width: 100%;
color:#FFf;
font-size: 5em;
}
#bottom{
position: fixed;
bottom:0;
height: 20%;
background: blue;
text-align: center;
width: 100%;
color:#FFf;
}
</style>
<body>
<!--在很久以前使用em/百分比
后来又发现了一个新单位rem/vw;vh-->
<div id="top">顶部导航条</div>
<div id="body">
使用em为单位,会根据父元素的字体大小为参考,比如父元素字体大小为12px,1em=12px;
使用rem为单位,会根据html根元素的字体大小为参考。
使用vw,vh作为单位是以当前屏幕视口为参考,
1vw=宽度的1%
</div>
<div id="bottom">底部选项卡</div>
</body>
</html>
本文来自博客园,作者:JackieDYH,转载请注明原文链接:https://www.cnblogs.com/JackieDYH/p/17634980.html

浙公网安备 33010602011771号