css新手上路
作者:unknown 来源:兵马俑bbs 添加时间:2006-5-25 18:22:11| 这一节我们将讨论如何用 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 12pt This 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 normal This paragraph's font is bold font-style 的可能的值是 lighter, normal, bold, bolder 我们只介绍在 Netscape 和 IE 上都通用的性质. 下一节我们讨 论文字的定位. |
站内搜索