css字体

字體類別

在顔色之後,一個網頁頁面最重要的特性大概就是字體。在本頁面中我不會示範任何「花招」,但我會指出CSS允許的字體變化範圍。

由於並非所有的電腦都有所有的字體(字體成千上萬,且多數不是免費的),CSS提供了一個應變系統。你先列出你想要的字體,然後爲首選的字體如果無法使用的備用字體,你也應以通用的字體來作爲這個列表的結束。通用字體共有五種:serif (襯線體), sans-serif(無襯線體), monospace(等寬體), cursive(草書體)fantasy(幻想體).

下表展示不同字體的範例(你的瀏覽器可能無法分辨所有這些字體),你可以看到這五種通用字體在你的瀏覽器上所顯示的效果:

'sans-serif': normal fonts without serifs
Arial, sans-serifThe Quick Brown Fox Jumps Over The Lazy Dog
Helvetica, sans-serifThe Quick Brown Fox Jumps Over The Lazy Dog
Gill Sans, sans-serifThe Quick Brown Fox Jumps Over The Lazy Dog
Lucida, sans-serifThe Quick Brown Fox Jumps Over The Lazy Dog
Helvetica Narrow, sans-serifThe Quick Brown Fox Jumps Over The Lazy Dog
sans-serifThe Quick Brown Fox Jumps Over The Lazy Dog
'serif': normal fonts with serifs
Times, serifThe Quick Brown Fox Jumps Over The Lazy Dog
Times New Roman, serifThe Quick Brown Fox Jumps Over The Lazy Dog
Palatino, serifThe Quick Brown Fox Jumps Over The Lazy Dog
Bookman, serifThe Quick Brown Fox Jumps Over The Lazy Dog
New Century Schoolbook, serifThe Quick Brown Fox Jumps Over The Lazy Dog
serifThe Quick Brown Fox Jumps Over The Lazy Dog
'monospace': fixed-width fonts
Andale Mono, monospaceThe Quick Brown Fox Jumps Over The Lazy Dog
Courier New, monospaceThe Quick Brown Fox Jumps Over The Lazy Dog
Courier, monospaceThe Quick Brown Fox Jumps Over The Lazy Dog
Lucidatypewriter, monospaceThe Quick Brown Fox Jumps Over The Lazy Dog
Fixed, monospaceThe Quick Brown Fox Jumps Over The Lazy Dog
monospaceThe Quick Brown Fox Jumps Over The Lazy Dog
'cursive': fonts that emulate handwriting
Comic Sans, Comic Sans MS, cursiveThe Quick Brown Fox Jumps Over The Lazy Dog
Zapf Chancery, cursiveThe Quick Brown Fox Jumps Over The Lazy Dog
Coronetscript, cursiveThe Quick Brown Fox Jumps Over The Lazy Dog
Florence, cursiveThe Quick Brown Fox Jumps Over The Lazy Dog
Parkavenue, cursiveThe Quick Brown Fox Jumps Over The Lazy Dog
cursiveThe Quick Brown Fox Jumps Over The Lazy Dog
'fantasy': decorative fonts, for titles, etc.
Impact, fantasyThe Quick Brown Fox Jumps Over The Lazy Dog
Arnoldboecklin, fantasyThe Quick Brown Fox Jumps Over The Lazy Dog
Oldtown, fantasyThe Quick Brown Fox Jumps Over The Lazy Dog
Blippo, fantasyThe Quick Brown Fox Jumps Over The Lazy Dog
Brushstroke, fantasyThe Quick Brown Fox Jumps Over The Lazy Dog
fantasyThe Quick Brown Fox Jumps Over The Lazy Dog

字體樣式

大部分同一類別的字體有多種不同的樣式,典型的有粗體字和斜體字,也經常有粗斜體字,稍少見的有小體大寫字,少數情況下有極細字/極粗字或延展字/壓縮字。

下表展示了許多不同的樣式。除非你有非常豐富的字集,否則其中許多行看來會是相同的:

ruleserifsans-serif
Styles
font-style: normalThe Quick…The Quick…
font-style: italicThe Quick…The Quick…
font-style: obliqueThe Quick…The Quick…
Weights
font-weight: 100The Quick…The Quick…
font-weight: 200The Quick…The Quick…
font-weight: 300The Quick…The Quick…
font-weight: normalThe Quick…The Quick…
font-weight: 500The Quick…The Quick…
font-weight: 600The Quick…The Quick…
font-weight: boldThe Quick…The Quick…
font-weight: 800The Quick…The Quick…
font-weight: 900The Quick…The Quick…
Variants
font-variant: normalThe Quick…The Quick…
font-variant: small-capsThe Quick…The Quick…
Stretch
font-stretch: ultra-condensedThe Quick…The Quick…
font-stretch: extra-condensedThe Quick…The Quick…
font-stretch: condensedThe Quick…The Quick…
font-stretch: semi-condensedThe Quick…The Quick…
font-stretch: normalThe Quick…The Quick…
font-stretch: semi-expandedThe Quick…The Quick…
font-stretch: expandedThe Quick…The Quick…
font-stretch: extra-expandedThe Quick…The Quick…
font-stretch: ultra-expanded The Quick…The Quick…

在CCS3中,還有一種樣式可使用:「字體特效」讓字母看似雕刻的或是浮凸的。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值