在CSS中,可以使用以下属性来设置字体:
font-family:用于设置字体类型。
font-size:用于设置字体大小。
font-weight:用于设置字体粗细。
font-style:用于设置字体风格,如斜体。
font-variant:用于设置小型大写字母。
line-height:用于设置行高。
text-decoration:用于设置文本装饰效果,如下划线、上划线、删除线等。
text-transform:用于设置文本转换效果,如大写、小写、首字母大写等。
letter-spacing:用于设置字符间距。
word-spacing:用于设置单词间距。
例如,以下代码将文本设置为"Arial"字体,大小为14px,粗体,行高为1.6倍,下划线装饰,大写字母,无空格:
p { font-family: Arial; font-size: 14px; font-weight: bold; line-height: 1.6; text-decoration: underline; text-transform: uppercase; letter-spacing: 0; word-spacing: 0; }