คุณสมบัติCSS font-weight
ตัวอย่าง
กำหนดน้ำหนักแบบอักษรที่แตกต่างกันสำหรับสามย่อหน้า:
p.normal {
font-weight: normal;
}
p.thick {
font-weight: bold;
}
p.thicker {
font-weight: 900;
}
ความหมายและการใช้งาน
คุณสมบัติfont-weight
กำหนดว่าควรแสดงอักขระหนาหรือบางในข้อความอย่างไร
ค่าเริ่มต้น: | ปกติ |
---|---|
รับการถ่ายทอด: | ใช่ |
เคลื่อนไหวได้: | ใช่. อ่านเกี่ยวกับแอนิเมชั่น |
รุ่น: | CSS1 |
ไวยากรณ์ JavaScript: | วัตถุ .style.fontWeight="bold" |
รองรับเบราว์เซอร์
ตัวเลขในตารางระบุเบราว์เซอร์รุ่นแรกที่สนับสนุนคุณสมบัติอย่างสมบูรณ์
Property | |||||
---|---|---|---|---|---|
font-weight | 2.0 | 4.0 | 1.0 | 1.3 | 3.5 |
ไวยากรณ์ CSS
font-weight: normal|bold|bolder|lighter|number|initial|inherit;
มูลค่าทรัพย์สิน
Value | Description | Play it |
---|---|---|
normal | Defines normal characters. This is default | |
bold | Defines thick characters | |
bolder | Defines thicker characters | |
lighter | Defines lighter characters | |
100 200 300 400 500 600 700 800 900 |
Defines from thin to thick characters. 400 is the same as normal, and 700 is the same as bold | |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
หน้าที่เกี่ยวข้อง
กวดวิชา CSS: แบบอักษร CSS
การอ้างอิง CSS: คุณสมบัติแบบอักษร
การอ้างอิง HTML DOM: คุณสมบัติ fontWeight