非常教程

CSS 参考手册教程

CSS font 属性

CSS font 属性

CSS font 属性


实例

指定在一个声明的所有字体属性:

p.ex1 { font:15px arial,sans-serif; } p.ex2 { font:italic bold 12px/30px Georgia, serif; }

尝试一下 »

在此页底部有更多的例子。

属性定义及使用说明

font 简写属性在一个声明中设置所有字体属性。

可设置的属性是(按顺序): "font-style font-variant font-weight font-size/line-height font-family"

font-size和font-family的值是必需的。如果缺少了其他值,默认值将被插入,如果有默认值的话。

注意: line - height属性设置行与行之间的空间。

默认值: not specified
继承: yes
版本: CSS1
JavaScript 语法: object.style.font="italic small-caps bold 12px arial,sans-serif"


浏览器支持

表格中的数字表示支持该属性的第一个浏览器版本号。

属性
font 1.0 4.0 1.0 1.0 3.5

Font 特性

描述
font-style 规定字体样式。参阅:font-style 中可能的值。
font-variant 规定字体异体。参阅:font-variant 中可能的值。
font-weight 规定字体粗细。参阅:font-weight 中可能的值。
font-size/line-height 规定字体尺寸和行高。参阅:font-size 和 line-height 中可能的值。
font-family 规定字体系列。参阅:font-family 中可能的值。
caption 定义被标题控件(比如按钮、下拉列表等)使用的字体。
icon 定义被图标标记使用的字体。
menu 定义被下拉列表使用的字体。
message-box 定义被对话框使用的字体。
small-caption caption 字体的小型版本。
status-bar 定义被窗口状态栏使用的字体。


CSS font 属性

更多实例

其他一些font属性值
这个例子演示了一些其他的font属性值。


相关文章

CSS 教程: CSS Font

CSS font 属性
CSS 参考手册

CSS 参考手册提供了完整的 CSS 属性列表,每个属性都配有语法说明及实例演示,另外还讲解了 CSS 选择器、颜色值及浏览器支持等相关内容。

CSS 参考手册目录

1.CSS 听觉参考手册
2.CSS 选择器
3.CSS 参考手册
4.CSS3 animation-name 属性
5.CSS3 animation 属性
6.CSS3 @keyframes 规则
7.CSS 浏览器支持
8.CSS 颜色十六进制值
9.CSS 颜色名称
10.CSS 合法颜色值
11.CSS 颜色
12.CSS 单位
13.CSS Web安全字体
14.CSS3 animation-timing-function 属性
15.CSS3 animation-duration 属性
16.CSS background-color 属性
17.CSS background-attachment 属性
18.CSS background 属性
19.CSS3 backface-visibility 属性
20.CSS3 appearance 属性
21.CSS3 animation-play-state 属性
22.CSS3 animation-iteration-count 属性
23.CSS3 animation-delay 属性
24.CSS background-repeat 属性
25.CSS background-position 属性
26.CSS background-image 属性
27.CSS border 属性
28.CSS3 background-size 属性
29.CSS3 background-origin 属性
30.CSS3 background-clip 属性
31.CSS border-bottom-style 属性
32.CSS border-bottom-color 属性
33.CSS border-bottom 属性
34.CSS border-right-style 属性
35.CSS border-right 属性
36.CSS border-left-width 属性
37.CSS border-left-style 属性
38.CSS border-left-color 属性
39.CSS Border-left 属性
40.CSS border-color 属性
41.CSS border-collapse 属性
42.CSS border-bottom-width 属性
43.CSS3 border-bottom-left-radius 属性
44.CSS border-width 属性
45.CSS border-top-color 属性
46.CSS border-top-style 属性
47.CSS border-top-width 属性
48.CSS border-top 属性
49.CSS border-style 属性
50.CSS border-spacing 属性
51.CSS border-right-width 属性
52.CSS border-right-color 属性
53.CSS3 border-image-width 属性
54.CSS3 border-radius 属性
55.CSS3 border-top-left-radius 属性
56.CSS3 border-top-right-radius 属性
57.CSS3 border-image-source 属性
58.CSS3 border-image-slice 属性
59.CSS3 border-image-repeat 属性
60.CSS3 border-image-outset 属性
61.CSS3 border-image 属性
62.CSS3 border-bottom-right-radius 属性
63.CSS3 box-sizing 属性
64.CSS3 box-pack 属性
65.CSS3 box-orient 属性
66.CSS3 box-ordinal-group 属性
67.CSS3 box-lines 属性
68.CSS3 box-flex-group 属性
69.CSS3 box-flex 属性
70.CSS3 box-direction 属性
71.CSS3 box-align 属性
72.CSS bottom 属性
73.CSS3 column-rule-color 属性
74.CSS3 column-rule 属性
75.CSS3 column-gap 属性
76.CSS3 column-fill 属性
77.CSS3 column-count 属性
78.CSS color 属性
79.CSS clip 属性
80.CSS clear 属性
81.CSS caption-side 属性
82.CSS3 box-shadow 属性
83.CSS :after 选择器
84.CSS :before 选择器
85.CSS content 属性
86.CSS3 columns 属性
87.CSS3 column-width 属性
88.CSS3 column-span 属性
89.CSS3 column-rule-width 属性
90.CSS3 column-rule-style 属性
91.CSS font 属性
92.CSS float 属性
93.CSS Empty-cells 属性
94.CSS display 属性
95.CSS direction 属性
96.CSS cursor 属性
97.CSS counter-reset 属性
98.CSS counter-increment 属性
99.CSS3 grid-columns 属性
100.CSS3 font-stretch 属性