文章均为个人原创, 搬运请附上原文地址感谢, 原文来自MasterYi博客
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>em 和 rem</title>
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover">
</head>
<style>
.em {
padding: 10px;
background: #1e9fff;
margin: 20px 0;
text-indent: 10px;
color: #fff;
width: 10em;
}
.rem {
padding: 10px;
background: #1e9fff;
margin: 20px 0;
text-indent: 10px;
color: #fff;
width: 10rem;
}
</style>
<body>
<div class="em">10em</div>
<div class="rem">10rem</div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>em 和 rem</title>
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover">
</head>
<style>
html {
font-size: 20px;
}
.em {
padding: 10px;
background: #1e9fff;
margin: 20px 0;
text-indent: 10px;
color: #fff;
width: 10em;
font-size: 14px;
}
.rem {
padding: 10px;
background: #1e9fff;
margin: 20px 0;
text-indent: 10px;
color: #fff;
width: 10rem;
font-size: 14px;
}
</style>
<body>
<div class="em">10em</div>
<div class="rem">10rem</div>
</body>
</html>