<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- meta: 定义页面的元数据,name="viewport"要解释的是视口 -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>移动端布局原理</title>
</head>
<body>
<div class="title">Hello Word!</div>
<style>
html{
font-size: calc(100vw / 3.75);
}
body{
font-size: 0.16rem;
}
@media (min-width:375px) {
html{
/* 最小字体大小是14px,14/0.16=87.5px */
font-size: 87.5px;
}
}
@media (max-width:475px) {
html{
/* 最大字体大小为20px,20/0.16=125 */
font-size: 125px;
}
}
</style>
</body>
</html>