时间: 2021-07-31 作者:daque
这一节咱们将计划怎样用 css 来遏制元素中字体的形势, 巨细, 作风. 字形css 用来遏制字形的本质是 font-family. 你不妨用它来确定任何一个元素中笔墨的字形. 比方 p.v {font-family: verdana} h2.a {font-family: arial}this h2's font is "times new roman"this paragraph is using "verdana" font有的功夫, 你所给的字体欣赏器不见得有,你不妨多给几种比方 p {font-family: verdana, forte, "times new roman"}上头这个设置不妨使得欣赏器先用verdana, 即使没有就用forte...记取每个字形之间要用逗点隔绝. 巨细用来遏制字体巨细的本质是 font-size 比方 p.f12 {font-size: 12pt} p.f18 {font-size: 18pt}this paragraph's font is 12ptthis paragraph's font is 18pt你不妨本人渐渐安排字体的巨细直到合意为止. 普遍来说, 字体的巨细没什么控制, 但 500 以次比拟安定. 斜体即使想让字体变成斜体, 要用 font-style 本质, 比方 p {font-style: italic}this paragraph's font is italic加剧用 font-weight 来安排笔墨的粗细, 比方 p.bold {font-weight: bold}this paragraph's font is normalthis paragraph's font is boldfont-style 的大概的值是 lighter, normal, bold, bolder 咱们只引见在 netscape 和 ie 上都通用的本质. 下一节咱们计划笔墨的定位.