Html 是否可以在 CSS 中禁用字体平滑?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10538570/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 00:20:32  来源:igfitidea点击:

Is it possible to disable font smoothing in CSS?

htmlcssfontsstylesheetfont-smoothing

提问by German Latorre

I want some small fonts to look with no smoothing. Is it possible to disable font smoothing using HTML/CSS?

我希望一些小字体看起来没有平滑。是否可以使用 HTML/CSS 禁用字体平滑?

回答by Eugene Trofimenko

Yes, it's possible, but not for all browsers.

是的,这是可能的,但并非适用于所有浏览器。

font-smooth: auto | never | always | <absolute-size> | length | initial | inherit
-webkit-font-smoothing : none | subpixel-antialiased | antialiased 

For your case:

对于您的情况:

font-smooth: never;
-webkit-font-smoothing : none;

UPD(for Chrome): Force Font Smoothing in Chrome on Windows

UPD(适用于 Chrome)在 Windows 上的 Chrome 中强制字体平滑

回答by Borodin

Yes, although I can't say which browsers will take any notice of you!

是的,虽然我不能说哪些浏览器会注意到你!

You can write

你可以写

<p style="font-smooth:never;">

to get the effect you want.

以获得你想要的效果。



EDIT

编辑

I was sure I had used this some months ago, but I read on the Mozilla Network

我确定几个月前我用过这个,但我在 Mozilla 网络上阅读

Though present in early (2002) drafts of CSS3 Fonts, font-smooth has been removed from this specification and is currently not on the standard track.

尽管出现在 CSS3 字体的早期(2002 年)草案中,但 font-smooth 已从该规范中删除,目前不在标准轨道上。

Sorry!

对不起!