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

วิธีใช้ CSS font-style Property

CSS font-style property ให้ใช้ font styles 3 แบบ: normal, italic, oblique:

.normal{ font-style: normal; } .italic { font-style: italic; } .oblique { font-style: oblique; }
  • normal: default roman/regular font style
  • italic: font ตวางขวาเล็กน้อย ใช้เน้น
  • oblique: font ตวางขวาเล็กน้อย ใช้เน้น

Italic และ oblique ใช้เน้นทั้งคู่ แตะต่างกันยังไง?

  • Italic font เป็น font ตัวของตัวเอง มี glyphs ออกแบบมาเฉพาะ
  • Oblique font แค่ slanted/skewed version ของ roman/regular font

ควรใช้ font style ไหน?

ผมไม่ใช้ oblique มันอยู่ในกลุ่มเดียวกับ faux italic — แม้ไม่ได้เรียกอย่างเป็นทางการ

ดูเปรียบเทียบ font styles จาก Droid Serif:

วิธีใช้ CSS font-style Property

เห็นปัญหาไหม? ไม่เห็นก็ไม่เป็นไร หลายคนไม่สังเกต — แต่หลายคนสังเกต ทำให้สำคัญ

  • Italic เป็น real font ออกแบบมาจาก roman/normal แต่มี glyphs ของตัวเอง
  • Oblique แค่ slanted/skewed version ของ normal font เหมือน faux italics (generic, computer-generated, ไม่ได้ออกแบบโดย typeface designer)

ถ้าใครชี้ความแตกต่างระหว่าง oblique และ faux italics ได้ ส่งอีเมลมาผมจะอัปเดตบทความ! 🙂