How to achieve font anti-aliasing rendering effect in CSS3? -webkit-font-smoothing property (example)

青灯夜游
Release: 2018-09-13 15:19:39
Original
2090 people have browsed it

This chapter will introduce to youHow to achieve font anti-aliasing rendering effect in CSS3? -webkit-font-smoothing attribute (example) has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

Anti-aliasing rendering of fonts can make the fonts look clearer and more comfortable. Today, as icon fonts become a trend, anti-aliased rendering is increasingly used.

font-smoothing is a non-standard CSS definition. It was included in the draft of the standard specification, but was later removed from the web standard for some reason.

However, we can use the following two definitions for anti-aliased rendering:

-webkit-font-smoothing: antialiased; /*chrome、safari*/
-moz-osx-font-smoothing: grayscale;/*firefox*/
Copy after login

1. Webkit supports this effect in its own engine.

-webkit-font-smoothing It has three attribute values:

1) none: better for low-pixel text

2) subpixel -antialiased: Default value

3) antialiased: anti-aliasing is very good

Example:

body{
   -webkit-font-smoothing: antialiased;
}
Copy after login

This attribute can make the font on the page anti-aliased. After using it, the font will look like will be clearer. After adding it, the page suddenly felt smaller and clearer.

2. Gecko also introduced its own non-standard definition of anti-aliasing effect.

-moz-osx-font-smoothing: inherit | grayscale;This property also has a clearer effect.

Example:

.icon {
   -webkit-font-smoothing: antialiased;
   -moz-osx-font-smoothing: grayscale;
}
Copy after login

3. The Ionic framework adds an additional font-smoothing: antialiased;

to the style. Are you waiting for font-smoothing to be standardized to be prepared?

The above is the detailed content of How to achieve font anti-aliasing rendering effect in CSS3? -webkit-font-smoothing property (example). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template