คุณสมบัติแบบอักษร CSS
คุณสมบัติแบบอักษร CSS
ในการย่อโค้ด คุณยังสามารถระบุคุณสมบัติฟอนต์แต่ละรายการในคุณสมบัติเดียวได้
font
ทรัพย์สินเป็นทรัพย์สินชวเลขสำหรับ:
font-style
font-variant
font-weight
font-size/line-height
font-family
หมายเหตุ:
ต้องระบุค่าfont-size
และ font-family
หากไม่มีค่าอื่นใดค่าหนึ่งหายไป ค่าเริ่มต้นจะถูกใช้
ตัวอย่าง
ใช้font
เพื่อตั้งค่าคุณสมบัติฟอนต์หลายอย่างในการประกาศครั้งเดียว:
p.a
{
font: 20px Arial, sans-serif;
}
p.b
{
font: italic small-caps bold 12px/30px Georgia, serif;
}
คุณสมบัติแบบอักษร CSS ทั้งหมด
Property | Description |
---|---|
font | Sets all the font properties in one declaration |
font-family | Specifies the font family for text |
font-size | Specifies the font size of text |
font-style | Specifies the font style for text |
font-variant | Specifies whether or not a text should be displayed in a small-caps font |
font-weight | Specifies the weight of a font |