<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Title</title>
<meta name="Keywords" content="关键字">
<meta name="description" content="简介">
<style>
.box {
width: 800px;
height: 200px;
background-color: aqua;
}
.box:after {
content: 'hello 800px 200px';
}
.ad {
/*em相对于父元素font-size尺寸*/
width: 11.5em;
background-color: green;
font-size: .14em;
}
body {
font-size: 100px;
}
.box3 {
font-size: 500px;
}
.box4 {
font-size: .14em;
}
</style>
</head>
<body>
<div class="box"></div>
<hr>
<div class="ad">ad
<p>Lorem ipsum dolor.</p>
<p>Laboriosam, sapiente, tempora!</p>
<p>Asperiores, harum soluta!</p>
</div>
<div class="box2">
<div class="box3">
<div class="box4">hello</div>
</div>
</div>
</body>
</html>
CSS px em rem
最新推荐文章于 2024-06-30 17:58:42 发布