font 簡寫屬性在一個聲明中設置所有字體屬性。
順序是:font-style 、font-variant、 font-weight 、font-size/line-height 、font-family
其中:font-size和font-family的值是必需的。要是缺少了其他值,默認值將被插入,如果有默認值的話。
例如:
span {
font: italic bold 12px< /span>/30px Georgia, serif;
}
font-style
設置字體樣式
參數:
normal
默認值,瀏覽器顯示的
italic
斜體
oblique
傾斜
inherit
繼承父元素字體樣式
span {
font-style: italic;
}
font-variant
小寫轉大寫字母
參數:
normal
默認值
small-caps
小寫轉大寫
inherit
繼承父元素
font-weight
字體粗細
參數:
normal
默認
bold
粗體
bolder
更粗
lighter
100 - 900 其中400 等同於 normal,而 700 等同於 bold
inherit
繼承父元素
font-size
字體大小
font-family
定義一個元素的字體
文章為用戶上傳,僅供非商業瀏覽。發布者:Lomu,轉轉請註明出處: https://www.daogebangong.com/zh-Hant/articles/detail/fonts%20in%20CSS.html
评论列表(196条)
测试