css字体怎么设置(设置表格单元格宽度-编程之家

本教程操作环境:windows7系统、css3版,DELL G3电脑。

css字体的设置方法:

font-family规定元素的字体系列。font-family可以把多个字体名称作为一个“回退”系统来保存。如果浏览器不支持第一个字体,则会尝试下一个。

示例:

设置文本的字体:

<html>
<head>
<style type="text/css">
p.serif{font-family:"Times New Roman",Georgia,Serif}
p.sansserif{font-family:Arial,Verdana,Sans-serif}
</style>
</head>
<body>
<h1>CSS font-family</h1>
<p class="serif">This is a paragraph, shown in the Times New Roman font.</p>
<p class="sansserif">This is a paragraph, shown in the Arial font.</p>
</body>
</html>

登录后复制

效果图:

css字体怎么设置(设置表格单元格宽度-编程之家

在 CSS 中,有两种不同类型的字体系列名称:

通用字体系列 – 拥有相似外观的字体系统组合(比如 "Serif" 或 "Monospace")

特定字体系列 – 具体的字体系列(比如 "Times" 或 "Courier")

除了各种特定的字体系列外,CSS 定义了 5 种通用字体系列:

  • Serif 字体

  • Sans-serif 字体

  • Monospace 字体

  • Cursive 字体

  • Fantasy 字体

以上就是css字体怎么设置的详细内容,更多请关注风君子博客其它相关文章!