Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> JavaScript

การใช้งานคุณสมบัติ font-weight ใน CSS


คุณสมบัติ font-weight

คุณสมบัติ font-weight ใช้เพิ่มหรือลดความหนาของฟอนต์ ให้ฟังก์ชันการระบุว่าฟอนต์จะหนาแน่เพียงไหน ค่าที่เป็นไปได้: normal, bold, bolder, lighter, 100, 200, 300, 400, 500, 600, 700, 800, 900

<html>
  <head>
  </head>
  <body>
    <p style="font-weight:bold;">This font is bold.</p>
    <p style="font-weight:bolder;">This font is bolder.</p>
    <p style="font-weight:300;">This font is 300 weight.</p>
  </body>
</html>

ค่าที่ใช้ได้:

  • Keyword: normal (400), bold (700), bolder, lighter
  • ตัวเลข: 100 (Thin) ถึง 900 (Black) ทุก 100

แก้ไขจากต้นฉบับ: ตัวอย่างบรรทัดสุดท้ายใช้ 300 แทน 500 เพื่อให้ตรงกับคอมเมนต์