?
This document uses PHP Chinese website manual Release
font:[ [ <' font-style '> || <' font-variant '> || <' font-weight '> ]? <' font-size '> [ / <' line-height '> ]? <' font-family '> ] | caption | icon | menu | message-box | small-caption | status-bar
默認(rèn)值:看獨(dú)立屬性自身
適用于:所有元素
繼承性:有
動(dòng)畫(huà)性:看獨(dú)立屬性自身
計(jì)算值:看獨(dú)立屬性自身
<' font-style '>:指定文本字體樣式
<' font-variant '>:指定文本是否為小型的大寫(xiě)字母
<' font-weight '>:指定文本字體的粗細(xì)
<' font-size '>:指定文本字體尺寸
<' line-height '>:指定文本字體的行高
<' font-family '>:指定文本使用某個(gè)字體或字體序列
caption:使用有標(biāo)題的系統(tǒng)控件的文本字體(如按鈕,菜單等)(CSS2)
icon:使用圖標(biāo)標(biāo)簽的字體(CSS2)
menu:使用菜單的字體(CSS2)
message-box:使用信息對(duì)話(huà)框的文本字體(CSS2)
small-caption:使用小控件的字體(CSS2)
status-bar:使用窗口狀態(tài)欄的字體(CSS2)
使用第一種聲明方式參數(shù)必須按照如上的排列順序,且 <' font-size '> 和 <' font-family '> 是不可忽略的。每個(gè)參數(shù)僅允許有一個(gè)值。忽略的將使用其參數(shù)對(duì)應(yīng)的獨(dú)立屬性的默認(rèn)值。
對(duì)于如何使用客戶(hù)端系統(tǒng)沒(méi)有字體和自定義字體,可以參閱@font-face規(guī)則。
對(duì)應(yīng)的腳本特性為font。
Values | IE | Firefox | Chrome | Safari | Opera | iOS Safari | Android Browser | Android Chrome |
---|---|---|---|---|---|---|---|---|
Basic Support | 6.0+ | 2.0+ | 4.0+ | 3.1+ | 3.5+ | 3.2+ | 2.1+ | 18.0+ |
<!DOCTYPE html> <html lang="zh-cmn-Hans"> <head> <meta charset="utf-8" /> <title>font_CSS參考手冊(cè)_web前端開(kāi)發(fā)參考手冊(cè)系列</title> <meta name="author" content="Joy Du(飄零霧雨), dooyoe@gmail.com, www.doyoe.com" /> <style> .test p{margin:15px 0;border:1px solid #000;} .font1 p{font:18px Simsun,arial,sans-serif;} .font2 p{font:italic 18px Simsun,arial,sans-serif;} .font3 p{font:italic small-caps 18px Simsun,arial,sans-serif;} .font4 p{font:italic small-caps bold 18px Simsun,arial,sans-serif;} .font5 p{font:italic small-caps bold 18px/2 Simsun,arial,sans-serif;} .caption p{font:caption;} .icon p{font:icon;} .menu p{font:menu;} .message-box p{font:message-box;} .small-caption p{font:small-caption;} .status-bar p{font:status-bar;} </style> </head> <body> <ul class="test"> <li class="font1"> <strong>只指定字體大小和字體:</strong> <p>本段文字將顯示為18px宋體。</p> </li> <li class="font2"> <strong>只指定字體樣式、大小和字體:</strong> <p>本段文字將顯示為斜體的18px宋體。</p> </li> <li class="font3"> <strong>只指定字體樣式、小型大寫(xiě)字母、大小和字體:</strong> <p>本段文字將顯示為斜體的帶小型大寫(xiě)字母的18px宋體。大小型大寫(xiě)字母對(duì)比:AaBbCcDdEeFfGg</p> </li> <li class="font4"> <strong>只指定字體樣式、小型大寫(xiě)字母、粗細(xì)、大小和字體:</strong> <p>本段文字將顯示為斜體的帶小型大寫(xiě)字母的加粗18px宋體。</p> </li> <li class="font5"> <strong>只指定字體樣式、小型大寫(xiě)字母、粗細(xì)、大小、行高和字體:</strong> <p>本段文字將顯示為行高為2的斜體的帶小型大寫(xiě)字母的加粗18px宋體。</p> </li> <li class="caption"> <strong>指定字體為caption:</strong> <p>本段文字將以caption的字體顯示。</p> </li> <li class="icon"> <strong>指定字體為icon:</strong> <p>本段文字將以icon的字體顯示。</p> </li> <li class="menu"> <strong>指定字體為menu:</strong> <p>本段文字將以menu的字體顯示。</p> </li> <li class="message-box"> <strong>指定字體為message-box:</strong> <p>本段文字將以message-box的字體顯示。</p> </li> <li class="small-caption"> <strong>指定字體為small-caption:</strong> <p>本段文字將以small-caption的字體顯示。</p> </li> <li class="status-bar"> <strong>指定字體為status-bar:</strong> <p>本段文字將以status-bar的字體顯示。</p> </li> </ul> </body> </html>
點(diǎn)擊 "運(yùn)行實(shí)例" 按鈕查看在線(xiàn)實(shí)例