所有与字体相关的 CSS 属性
属性名 | 功能说明 |
---|---|
font-family |
设置字体系列(如 Arial, "宋体") |
font-size |
设置字体大小(如 16px, 1.2em) |
font-weight |
设置字体粗细(如 bold, 400) |
font-style |
设置字体风格(如 italic, oblique) |
font-variant |
设置小型大写字体(如 small-caps) |
line-height |
设置行高,影响段落的可读性 |
letter-spacing |
设置字母间距 |
word-spacing |
设置单词间距 |
text-transform |
设置文本大小写(如 uppercase) |
text-decoration |
设置文本装饰(如 underline) |
font |
简写属性,组合设置 font-style、font-weight、font-size、line-height 和 font-family |
@font-face |
引入自定义字体文件 |
超级好看的字体样式组合示例
1. 现代简约风格
body {
font-family: 'Helvetica Neue', Arial, sans-serif;
font-size: 18px;
font-weight: 300;
letter-spacing: 0.5px;
line-height: 1.6;
}
适合科技类网站、博客、作品集。
2. 优雅杂志风格
h1 {
font-family: 'Playfair Display', serif;
font-size: 48px;
font-weight: 700;
font-style: italic;
letter-spacing: 1px;
}
适合时尚、生活方式类内容。
3. 极简日式风格(适合中文)
body {
font-family: '思源黑体', 'Noto Sans CJK SC', sans-serif;
font-size: 16px;
font-weight: 400;
line-height: 1.8;
}
适合极简设计、文化类网站。
4. 手写艺术风格
.quote {
font-family: 'Pacifico', cursive;
font-size: 24px;
font-weight: normal;
color: #555;
}
适合插画、创意工作者的个人页面。
5. 未来感科技风格
.title {
font-family: 'Orbitron', sans-serif;
font-size: 36