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

ทำให้ฟอนต์บาง (Thin Fonts) แสดงเรียบเนียนใน CSS3/HTML

CSS Properties สำหรับ Font Rendering

/* ทั่วไป */
text-rendering: optimizeLegibility !important;
-webkit-font-smoothing: antialiased !important;
-moz-osx-font-smoothing: grayscale !important;

/* Chrome เฉพาะ */
-webkit-font-smoothing: antialiased !important;

/* ค่า text-rendering อื่นๆ */
text-rendering: auto;
text-rendering: optimizeSpeed;
text-rendering: optimizeLegibility;
text-rendering: geometricPrecision;
text-rendering: inherit;

คำอธิบาย

  • optimizeLegibility เปิด ligatures และ kerning ให้อ่านง่าย
  • antialiased ทำให้ขอบฟอนต์เรียบ (Mac/iOS)
  • grayscale ใช้ grayscale anti-aliasing แทน subpixel (Firefox OS X)

ใช้ !important เพื่อ override browser defaults