CSS 字体搭配
优秀的网页设计肯定离不开优秀的字体搭配。
字体搭配的规则
1.互相补充
找到相互补充的字体搭配总是安全的。
一个很棒的字体组合应该是协调的,而不是太相似或太不同。
2.使用 Font Superfamilies
Font Superfamilies 是一组设计得很好地协同工作的字体。因此,使用同一个 Font Superfamilies 下的不同字体是安全的。
例如,Lucida superfamily 包含以下字体:Lucida Sans、Lucida Serif、Lucida Typewriter Sans、Lucida Typewriter Serif 和 Lucida Math。
3.对比是王道
两种过于相似的字体经常会发生冲突。然而,做一下对比,可以带来了最好的字体组合效果。
示例:将衬线与无衬线组合是一种众所周知的组合。
一个强大的 Font Superfamilies 包括相同字体的衬线和无衬线变体(例如 Lucida 和 Lucida sans)。
4.只选一个老大
默认字体只能是一个。这将为页面上的字体建立层次结构。这可以通过改变尺寸、重量和颜色来实现。
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-color: black;
font-family: Verdana, sans-serif;
font-size: 16px;
color: gray;
}
h1 {
font-family: Georgia, serif;
font-size: 60px;
color: white;
}
</style>
</head>
<body>
<h1>Beautiful Norway</h1>
<p>Norway has a total area of 385,252 square kilometers and a population of 5,438,657 (December 2020). Norway is bordered by Sweden, Finland and Russia to the north-east, and the Skagerrak to the south, with Denmark on the other side.</p>
</body>
</html>
下面,我们展示了一些流行的字体配对,它们将适合许多品牌和环境。
常用的字体搭配
Georgia 和 Verdana
Georgia 和 Verdana,是一个经典的组合。它还坚持 Web 安全字体标准:
<!DOCTYPE html>
<html>
<head>
<style>
body {
font-family: Verdana, sans-serif;
font-size: 16px;
}
h1 {
font-family: Georgia, serif;
font-size: 46px;
}
</style>
</head>
<body>
<h1>Beautiful Norway</h1>
<p>Norway has a total area of 385,252 square kilometers and a population of 5,438,657 (December 2020). Norway is bordered by Sweden, Finland and Russia to the north-east, and the Skagerrak to the south, with Denmark on the other side.</p>
</body>
</html>
Helvetica 和 Garamond
Helvetica 和 Garamond,是另一个使用网络安全字体的经典组合:
<!DOCTYPE html>
<html>
<head>
<style>
body {
font-family: Garamond, serif;
font-size: 16px;
}
h1 {
font-family: Helvetica, sans-serif;
font-size: 46px;
}
</style>
</head>
<body>
<h1>Beautiful Norway</h1>
<p>Norway has a total area of 385,252 square kilometers and a population of 5,438,657 (December 2020). Norway is bordered by Sweden, Finland and Russia to the north-east, and the Skagerrak to the south, with Denmark on the other side.</p>
</body>
</html>
流行的 Google 字体搭配
如果您不想在HTML中使用标准字体,可以使用 Google 字体。
下面是一些流行的 google web 字体对:
Merriweather 与 Open Sans
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Merriweather|Open+Sans">
<style>
body {
font-family: "Open Sans", sans-serif;
font-size: 16px;
}
h1 {
font-family: Merriweather, serif;
font-size: 46px;
}
</style>
</head>
<body>
<h1>Beautiful Norway</h1>
<p>Norway has a total area of 385,252 square kilometers and a population of 5,438,657 (December 2020). Norway is bordered by Sweden, Finland and Russia to the north-east, and the Skagerrak to the south, with Denmark on the other side.</p>
</body>
</html>
Ubuntu 和 Lora
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Ubuntu|Lora">
<style>
body {
font-family: Lora, serif;
font-size: 16px;
}
h1 {
font-family: Ubuntu, sans-serif;
font-size: 46px;
}
</style>
</head>
<body>
<h1>Beautiful Norway</h1>
<p>Norway has a total area of 385,252 square kilometers and a population of 5,438,657 (December 2020). Norway is bordered by Sweden, Finland and Russia to the north-east, and the Skagerrak to the south, with Denmark on the other side.</p>
</body>
</html>
Abril Fatface 和 Poppins
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Abril+Fatface|Poppins">
<style>
body {
font-family: Poppins, sans-serif;
font-size: 16px;
}
h1 {
font-family: 'Abril Fatface', serif;
font-size: 46px;
}
</style>
</head>
<body>
<h1>Beautiful Norway</h1>
<p>Norway has a total area of 385,252 square kilometers and a population of 5,438,657 (December 2020). Norway is bordered by Sweden, Finland and Russia to the north-east, and the Skagerrak to the south, with Denmark on the other side.</p>
</body>
</html>
如需所有可用的 Google 字体列表,请访问本站的 完整的 Google 字体。