我想让一些小字体看起来没有平滑处理。是否可以使用HTML/CSS禁用字体平滑处理?
我想让一些小字体看起来没有平滑处理。是否可以使用HTML/CSS禁用字体平滑处理?
是的,这是可能的,但并非适用于所有浏览器。
font-smooth: auto | never | always | <absolute-size> | length | initial | inherit
-webkit-font-smoothing : none | subpixel-antialiased | antialiased
针对您的情况:
font-smooth: never;
-webkit-font-smoothing : none;
UPD(for Chrome): 在Windows上强制Chrome字体平滑显示
<p style="font-smooth:never;">
编辑
我确信几个月前我曾使用过这个功能,但我在Mozilla Network上读到:
尽管在CSS3字体的早期(2002年)草案中存在,但“font-smooth”已被从该规范中删除,目前不在标准轨道上。
抱歉!
尝试使用font-smooth: never;
。
http://webdesign.about.com/od/styleproperties/p/blspfontsmooth.htm
<svg class="offscreen" width="0" height="0" xmlns="http://www.w3.org/2000/svg">
<defs>
<filter id="crispify">
<feComponentTransfer>
<feFuncA type="discrete" tableValues="0 1"/>
</feComponentTransfer>
</filter>
</defs>
</svg>
p {
filter: url(#crispify);
}
.offscreen {
position: absolute;
left: -100000px;
top: auto;
width: 1px;
height: 1px;
overflow: hidden;
}
p {
filter: url(#crispify) invert(1);
}