css中font(字型)中不同屬性的介紹

來源:互聯網
上載者:User
本篇文章給大家帶來的內容是關於css中font(字型)中不同屬性的介紹,有一定的參考價值,有需要的朋友可以參考一下,希望對你有所協助。

簡寫順序:style-variant-weight-size/line-height-family

eg:

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

注意:font-size和font-family的值是必需的。

按順序依次介紹每個屬性:

一、font-style:normal(預設);italic(斜體); oblique(傾斜);inherit;

italic與oblique樣式很像,不過oblique相容性不好。

二、font-variant:normall(預設);small-caps(顯示小型大寫字母的字型;意味著所有的小寫字母均會被轉換為大寫,但是所有使用small-caps的字母與其餘文本相比,字型尺寸更小);inherit;

三、font-weight:normal(預設,400);bold(700);bolder;lighter;inherit;

四、font-size:medium(預設,中等的);smaller(比父元素更小的尺寸);larger(比父元素更大的尺寸);length;%;inherit;

其中與medium並列的屬性有:xx-small,x-small,small,meidium,large,x-large,xx-large.

五、font-family

eg:

p{font-family:"Times New Roman",Time,serif;}

寫法:(1)每個值用逗號分開(2)如果字型名稱包含空格,它必須加上雙引號。在html中使用“style”屬性時,使用單引號。

注意:(1)在電腦螢幕上,sans-serif字型被認為是比serif字型容易閱讀。(2)font-family有family-name(指定的系列)和generic-family(通常字型系列)。使用某種特定的字型完全取決於使用者機器上該字型是否可用,因此,強烈推薦使用一個通用字型系列名作為後路。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.