CSS 是否支持文本抗锯齿,例如“清晰、清晰等”?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5811166/
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-30 00:24:37  来源:igfitidea点击:

Does CSS support text anti-aliasing such as "crisp, sharp etc" yet?

textcssantialiasing

提问by Brett

I have some text in Photoshop & it's set to "crisp". When I put it on my site it doesn't quite look the same.

我在 Photoshop 中有一些文本,它被设置为“清晰”。当我把它放在我的网站上时,它看起来不太一样。

Does anything exist in CSS yet that I can use to make it crisp? Or not?

CSS 中是否存在任何我可以用来使它清晰的东西?或不?

Or do you have any suggestions to achieve a similar effect?

或者你有什么建议可以达到类似的效果?

采纳答案by Spudley

Not only is it not possible, but different browsers on the market enforce different antialiasing settings, meaning that you can't get consistent results, even if they are not what you want.

不仅不可能,而且市场上不同的浏览器会强制执行不同的抗锯齿设置,这意味着您无法获得一致的结果,即使它们不是您想要的。

For a good article on how the various browsers deal with font rendering, I'd suggest reading this: http://blog.typekit.com/2010/10/21/type-rendering-web-browsers/

有关各种浏览器如何处理字体渲染的好文章,我建议阅读:http: //blog.typekit.com/2010/10/21/type-rendering-web-browsers/

回答by Alex

this is what I found on a big company's web site:

这是我在一家大公司的网站上找到的:

body, table, form {
font: 12px/18px "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif; 
background-color: transparent; 
color: #333; 
-webkit-font-smoothing: antialiased;}

回答by rockerest

What you're really asking is:

你真正想问的是:

"Is it possible to control anti-aliasing from the web development perspective?"

“从Web开发的角度来看,是否可以控制抗锯齿?”

The answer, for now, and for at least some time into the future (until OS/browser vendors start giving that kind of developmental control [don't hold your breath]) is undeniably: NO.

就目前而言,至少在未来一段时间内(直到操作系统/浏览器供应商开始提供这种开发控制 [不要屏住呼吸]),答案无疑是:不。

回答by Gil Perez

Try This code snippet

试试这个代码片段

 body {
   -webkit-font-smoothing: antialiased;
   -moz-osx-font-smoothing: grayscale;
}