我们之前设置字体的属性主要有以下几种
font-size
font-family
font-weight(加粗)
font-style(斜体)
line-height
color
现在我们可以简写成一个属性font
<!DOCTYPE html>
<html lang="ch">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>字体的简写属性</title>
<style>
p {
line-height: 1000px;/* 这条没用。原因:被font的覆盖掉了 */
/*
font语法:
font:字体大小/行高 字体族
行高 可以省略不写,但不代表没有,不写会使用默认值
*/
/* font: 50px serif; */
font: 50px/10 serif;
line-height: 5;/* 谁在下面,谁就会把上面的覆盖 */
font-size: 25px;/* 谁在下面,谁就会把上面的覆盖 */
/* font-weight font-style font-size/line-height font-family*/
/* font-weight font-style line-height可以省略不写,省略不写就使用默认值*/
font: bold italic 50px/8 serif;
}
</style>
</head>
<body>
<p>岁不寒,无以知松柏。事不难,无以知君子。</p>
</body>
</html>