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

เพิ่มหรือลดความหนาของฟอนต์ด้วย CSS (font-weight)


คุณสมบัติ 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:400;">This font is 400 weight.</p>
  </body>
</html>

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

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

แก้ไขจากต้นฉบับ: ตัวอย่างบรรทัดสุดท้ายเขียน 400 แต่คอมเมนต์เขียน 500 - แก้ให้ตรงกันแล้ว