Anti-aliasing
Embed This Widget
Add the script tag and a data attribute to embed this widget.
Embed via iframe for maximum compatibility.
<iframe src="https://fontfyi.com/iframe/glossary/anti-aliasing/" width="420" height="400" frameborder="0" style="border:0;border-radius:10px;max-width:100%" loading="lazy"></iframe>
Paste this URL in WordPress, Medium, or any oEmbed-compatible platform.
https://fontfyi.com/glossary/anti-aliasing/
Add a dynamic SVG badge to your README or docs.
[](https://fontfyi.com/glossary/anti-aliasing/)
Use the native HTML custom element.
Smoothing the jagged edges of rendered text by blending edge pixels. CSS: -webkit-font-smoothing: antialiased.
Anti-aliasing is a rendering technique that smooths the jagged, staircase edges that appear when vector letterforms are converted to pixels. Because display pixels are arranged in a grid and letter outlines are smooth curves, the conversion process inevitably creates rough, blocky edges — particularly visible on diagonal strokes and curves. Anti-aliasing softens these edges by calculating partially-covered pixels and rendering them at intermediate opacity or color values.
The fundamental challenge is that letter outlines are continuous curves living in a world of discrete grid squares. A diagonal stroke cutting across pixel boundaries will partially cover some pixels and fully cover others. Without anti-aliasing, each pixel is simply on or off — the result is the "jaggies" or aliased appearance. Anti-aliasing calculates the coverage percentage of each boundary pixel and renders it at proportional opacity.
/* OS-level anti-aliasing control in CSS */
/* macOS: subpixel vs grayscale anti-aliasing */
body {
-webkit-font-smoothing: antialiased; /* Grayscale anti-aliasing */
-moz-osx-font-smoothing: grayscale; /* Firefox on macOS */
}
/* The default on macOS is 'subpixel-antialiased' — using RGB subpixels */
/* Resetting to default: */
.subpixel {
-webkit-font-smoothing: auto;
}
/* Disable anti-aliasing (rarely appropriate) */
.no-smooth {
-webkit-font-smoothing: none;
}
/* The context where this matters most */
.dark-background-text {
background: #1a1a2e;
color: #ffffff;
-webkit-font-smoothing: antialiased;
/* Subpixel AA looks poor on dark backgrounds — grayscale AA is better */
}
.light-background-text {
background: #ffffff;
color: #1a1a2e;
-webkit-font-smoothing: auto;
/* Subpixel AA is fine on light backgrounds */
}
There are two main anti-aliasing approaches used in text rendering. Grayscale anti-aliasing uses only gray values to smooth edges — each boundary pixel is rendered in the appropriate gray between background and foreground color. Subpixel anti-aliasing exploits the fact that LCD pixels contain separate red, green, and blue subpixels arranged horizontally. By addressing subpixels individually, it effectively triples the horizontal resolution available for rendering text edges — producing sharper results on LCD displays. However, subpixel rendering assumes a specific subpixel arrangement and looks poor on dark backgrounds or OLED displays.
The -webkit-font-smoothing: antialiased declaration explicitly requests grayscale anti-aliasing, overriding macOS's default subpixel rendering. This is commonly applied for text on dark backgrounds or for UI elements where the slight weight reduction from grayscale anti-aliasing (text appears thinner) is aesthetically preferred. Typefaces like Inter and Roboto are designed and tested with both anti-aliasing modes in mind — part of what makes them reliable across diverse rendering environments.
相关术语
展示此概念的字体
了解更多
如何在浏览器、设备和屏幕尺寸间测试排版——截断、溢出、多语言以及视觉回归测试。
无障碍设计深色模式的排版需要不同的处理方式——更轻的字重、调整过的对比度,以及为保持可读性而精心选择的颜色。
CSS 排版是否应该使用 -webkit-font-smoothing: antialiased?text-rendering: optimizeLegibility 实际做了什么?权威解答。
排版基础排版史上最古老的争论,在网页时代得到解答。何时使用衬线体,何时使用无衬线体,以及研究到底说了什么。