目录

font

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

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

font-size和font-family的值是必需的。

 

语法

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

例子

HTML

<p class="ex1">This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph.</p>
<p class="ex2">This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph.</p>

CSS

p.ex1
{
	font:15px arial,sans-serif;
}

p.ex2
{
	font:italic bold 12px/30px Georgia,serif;
}

执行结果

This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph.

This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph.

参考

相关链接

外部链接