**font**
* 描述:復合屬性。設置對象中的文本特性。
* 版本:CSS1
* 繼承性:有
**語法**
方式一
```
font: font-style | font-varian | font-weight ? font-size/line-height ? font-family ;
```
方式二
```
font:caption | icon | menu | message-box | small-caption | status-bar;
```
類型值
方式一
font-style:設置文本字體樣式
font-variant:設置文本是否為小型的大寫字母
font-weight:設置文本字體的粗細
font-size:設置文本字體大小
line-height:設置文本字體的行高
font-family:設置文本使用的字體或字體序列
方式二
caption:使用有標題的系統控件的文本字體,如按鈕,菜單等(CSS2)
icon:使用圖標標簽的字體(CSS2)
menu:使用菜單的字體(CSS2)
message-box:使用信息對話框的文本字體(CSS2)
small-caption:使用小控件的字體(CSS2)
status-bar:使用窗口狀態欄的字體(CSS2)
**使用說明**
方式一聲明參數必須按照如上的排列順序,且 font-size 和 font-family 是不可忽略的。
方式一每個參數僅允許有一個值。忽略的將使用其參數對應的獨立屬性的默認值。
**代碼示例**
```
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>font</title>
<style>
.p1{
font:18px Simsun,arial,sans-serif;
}
.p2{
font: message-box;
}
.p3{
font: italic small-caps bold 20px/2 sans-serif;
}
</style>
</head>
<body>
<div id="container">
<p class="p1">第一行</p>
<p class="p2">第二行</p>
<p class="p3">第三行 ARE YOU OK?</p>
</div>
</body>
</html>
```

- 空白目錄
- CSS3專業名詞
- 復合屬性
- 繼承性
- CSS3背景
- background
- background-color
- background-image
- background-repeat
- background-attachment
- background-position
- background-origin
- background-clip
- background-size
- CSS邊框
- border
- border-width
- border-style
- border-color
- border-top
- border-top-width
- border-top-style
- border-top-color
- border-right
- border-right-width
- border-right-style
- border-right-color
- border-bottom
- border-bottom-width
- border-bottom-style
- border-bottom-color
- border-left
- border-left-width
- border-left-style
- border-left-color
- border-radius
- border-top-left-radius
- border-top-right-radius
- border-bottom-right-radius
- border-bottom-left-radius
- CSS顏色
- color
- opacity
- CSS字體
- font
- font-style
- font-variant
- font-weight
- font-size
- font-family
- font-stretch
- font-size-adjust
- CSS定位
- position
- z-index
- clip