font-size: medium|large|x-large|xx-large|xx-small|x-small|small|;
<!DOCTYPE html>
<html>
<head>
<style>
#first {
font-size: 40px;
}
#second {
font-size: 20px;
}
</style>
</head>
<body>
<p id="first">这个段落的大小是40px。</p>
<p id="second">这个段落的大小是20px。</p>
</body>
</html>
这个段落的大小是40px。
这个段落的大小是20px。
<!DOCTYPE html>
<html>
<head>
<style>
#first {
font-size: 2.5em; /* 40px/16=2.5em */
}
#second {
font-size: 1.875em; /* 30px/16=1.875em */
}
#third {
font-size: 0.875em; /* 14px/16=0.875em */
}
</style>
</head>
<body>
<p id='first'>第一段。</p>
<p id='second'>第二段。</p>
<p id='third'>第三段。</p>
</body>
</html>
第一段。
第二段。
第三段。
<!DOCTYPE html>
<html>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<body>
<p style="font-size:5vw;">第一段的宽度为1vw。</p>
<p style="font-size:10vw;">第二段宽度为2vw。</p>
</body>
</html>
第一段的宽度为5vw。
第二段宽度为10vw。
font-size: length;
<!DOCTYPE html>
<html>
<head>
<style>
.length {
color:red;
font-size: 1.5cm;
}
</style>
</head>
<body>
<h1>字体大小属性。</h1>
<p class = "length">长度为1.5cm的段落。</p>
</body>
</html>
长度为1.5cm的段落。