CSS font-synthesis

View Output Full Screen Preview

The font-synthesis property allows you to specify whether user agents are allowed to synthesize bold, oblique, small-caps, or subscript/superscript font faces when a font family lacks a dedicated glyph for that purpose.

The font-synthesis property is one of the properties introduced in CSS3 for enabling various font related features that can improve the appearance of the text on the page. The font-synthesis property allows you to disable the user agent's default behavior of synthesizing bold, italic, small-caps, and subscript/superscript font faces when the font family lacks those specific faces.

Example of synthetically generated bold and italics

This is what the above code example should look like if your browser supports the font-synthesis property. The text on the left has had none applied, which means that the bold and italic faces are not synthetically generated. The text on the right has had both bold and italics synthetically generated. Because this paricular font doesn't have purpose built bold and italic faces, the text on the left remains normal (i.e. not bold or italic). If the font had dedicated bold and italic glyphs, all of the text would have been bolded and italicised using those glyphs.

Many font families include bold and italic versions of each font face, which are used any time you specify text to be bold or italic. If the font family doesn't include these, the user agent/browser will synthesize the process. In many cases this might be fine, but in some cases it could have less than desirable results. Depending on the font being used, the browser may or may not do a good job in this process. Therefore, the font-synthesis property can be used to explicitly instruct the browser not to do this. In other words, if there's a purpose built glyph available, use it, otherwise just use normal glyph without bolding or italicising it.

Example of real bold and italics vs a synthetically generated version

The top line has real bold and italic faces whereas the bottom line has synthetic bold and italic faces. Notice the real bold is stronger and the real italics have a nicer, almost cursive feel. The synthetic version on the other hand has a weaker bold, and the italics seem to be a "pushed over" version of the normal font. No design embellishments have been applied to make it more attractive.

Syntax

The syntax of the font-synthesis property is:

Possible Values

none
Disallows all synthetic faces.
weight
Specifies that the user agent is allowed to synthesize bold text.
style
Specifies that the user agent is allowed to synthesize italic text.
small-caps
Specifies that the user agent is allowed to synthesize small-caps font faces.
position
Specifies that the user agent is allowed to synthesize subscript and superscript font faces.

In addition, all CSS properties also accept the following CSS-wide keyword values as the sole component of their property value:

initial
Represents the value specified as the property's initial value.
inherit
Represents the computed value of the property on the element's parent.
unset
This value acts as either inherit or initial, depending on whether the property is inherited or not. In other words, it sets all properties to their parent value if they are inheritable or to their initial value if not inheritable.

General Information

Initial Value
weight style small-caps position
Applies To
All elements
Inherited?
Yes
Media
Visual
Animatable?
No

Example Code

Official Specifications

Browser Support

Browser support for CSS properties can vary, particularly for newer or experimental features. Check current browser compatibility before using a property in production, especially when supporting older browsers.

The following table provided by Caniuse.com shows the level of browser support for this feature.

Initial Value

CSS properties have an initial value that applies when the property has not been explicitly set. The initial value is different from the value inherited from a parent element and may vary between properties.

Inheritance

Some CSS properties inherit their computed value from their parent element by default, while others do not. The inherit, initial, unset, and revert keywords can also be used to control how a property gets its value.

Vendor Prefixes

Most modern CSS properties use the standard, unprefixed syntax. Vendor-prefixed properties such as -webkit- are mainly relevant to older browser versions or specific features and should only be used when required by your browser support targets.