CSS 中的字体系列
cssweb developmentfront end technology更新于 2025/1/14 10:52:17
CSS 的 font-family 属性用于为所选元素设置特定字体。建议通过指定其他字体来使用网页安全字体,以确保跨浏览器兼容性。
语法
CSS font-family 属性的语法如下 &
Selector {
font-family: /*value*/
}
−
示例
<!DOCTYPE html>
<html>
<head>
<style>
h2 {
background-color: thistle;
font-family: "Magneto", Arial;
}
p {
font-family: "Segoe Print", serif;
font-size: 1.4em;
}
</style>
</head>
<body>
<h2>Learn Fortran</h2>
<p>Fortran, as derived from Formula Translating System, is a general-purpose, imperative programming language. It is used for numeric and scientific computing.</p>
</body>
</html>
输出
这将给出以下输出 −

示例
<!DOCTYPE html>
<html>
<head>
<style>
th {
font-family: "Franklin Gothic Book", Arial;
border: thin solid blue;
}
td {
font-family: "Lucida Console", serif;
font-size: 1.1em;
box-shadow: inset 0 0 3px black;
}
caption {
font-family: Broadway;
font-size: 24px;
}
</style>
</head>
<body>
<table>
<caption>Demo Table</caption>
<tr>
<th>DEMO 1</th>
<th>DEMO 2</th>
</tr>
<tr>
<td>demo a</td>
<td>demo b</td>
</tr>
<tr>
<td>demo c</td>
<td>demo d</td>
</tr>
</table>
</body>
</html>
输出
这将给出以下输出 −

相关文章
有用资源
css 参考教程 - 该教程包含有关 css 的更多信息:https://www.cainiaomax.com/css/

