mozilla
Your Search Results

    font-feature-settings

    Summary

    The font-feature-settings CSS property gives you control over advanced typographic features in OpenType fonts.

    Note: Whenever possible, Web authors should use the font-variant shorthand property or an associated longhand property, font-variant-ligatures, font-variant-caps, font-variant-east-asian, font-variant-alternates, font-variant-numeric or font-variant-position.

    This property is a low-level feature designed to handle special cases where no other way to enable or access an OpenType font feature exists.

    In particular, this CSS property shouldn't be used to enable small caps.

    Syntax

    /* Use the default settings */
    font-feature-settings: normal;
    
    /* Set values for OpenType feature tags */
    font-feature-settings: "smcp";
    font-feature-settings: "smcp" on;
    font-feature-settings: "swsh" 2;
    font-feature-settings: "smcp", "swsh" 2;
    
    font-feature-settings: inherit;
    

    Values

    normal
    Text is laid out using default settings.
    <feature-tag-value>
    When rendering text, the list of OpenType feature tag value is passed to the text layout engine to enable or disable font features. The tag is always a <string> of 4 ASCII characters. If it has more or less characters or contains characters outside the U+20 - U+7E codepoint range, the whole property is invalid.
    The value is an positive integer. The two keywords on and off are synonyms for 1 and 0 respectively. If no value is set, the default is 1. For non-Boolean OpenType features (e.g. stylistic alternates), the value implies a particular glyph to be selected; for Boolean values, it is a switch.

    Formal syntax

    normal | <feature-tag-value>#
    

    Examples

    /* use small-cap alternate glyphs */
    .smallcaps { font-feature-settings: "smcp" on; }
    
    /* convert both upper and lowercase to small caps (affects punctuation also) */
    .allsmallcaps { font-feature-settings: "c2sc", "smcp"; }
    
    /* enable historical forms */
    .hist { font-feature-settings: "hist"; }
    
    /* disable common ligatures, usually on by default */
    .noligs { font-feature-settings: "liga" 0; }
    
    /* enable tabular (monospaced) figures */
    td.tabular { font-feature-settings: "tnum"; }
    
    /* enable automatic fractions */
    .fractions { font-feature-settings: "frac"; }
    
    /* use the second available swash character */
    .swash { font-feature-settings: "swsh" 2; }
    
    /* enable stylistic set 7 */
    .fancystyle {
      font-family: Gabriola; /* available on Windows 7, and on Mac OS */
      font-feature-settings: "ss07";
    }
    

    Specificat​ions

    Specification Status Comment
    CSS Fonts Module Level 3
    The definition of 'font-feature-settings' in that specification.
    Candidate Recommendation  

    Browser compatibility

    Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
    Basic support 16.0 -webkit 4.0 (2.0) [1][2][3]-moz
    34.0 (34.0)
    10.0 18.0 (or earlier?) -o Not supported
    Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
    Basic support ? 4.0 (2.0) [1][2][3]-moz
    34.0 (34.0)
    ? ? ?

    [1] From Gecko 2.0 (Firefox 4.0) to Gecko 14.0 (Firefox 14.0) included, Gecko supported an older syntax, slightly different from the modern one: OpenType Font Feature support in Firefox 4.

    [2] The ISO/IEC CD 14496-22 3rd edition suggests to use the ssty feature to provide glyph variants adjusted to be more suitable for use in scripts (for example primes used as superscripts). Starting with Firefox 29, this is done automatically by the MathML rendering engine. It also suggests applying the dtls feature to letters when positing mathematical accent over it, in order to get dotless forms (for example dotless i, j with a hat). Starting with Firefox 35, this is done automatically by the MathML rendering engine. You can always override via CSS the default values determined by the MathML rendering engine.

    [3] Starting with Firefox 34, the version prefixed with -moz- is only kept for backward compatibility purpose. It is controlled by the layout.css.prefixes.font-features, defaulting to true. The prefixed property will be remove in the future.

    See also

    Document Tags and Contributors

    Last updated by: wbamberg,