Back to Content

CSSFontFeatureValuesRule: annotation property

files/en-us/web/api/cssfontfeaturevaluesrule/annotation/index.md

latest1.6 KB
Original Source

{{ APIRef("CSSOM") }}{{SeeCompatTable}}

The read-only annotation property of the {{domXRef("CSSFontFeatureValuesRule")}} interface contains a {{domXRef("CSSFontFeatureValuesMap")}} object representing the user-defined-ident and feature index for a variable font which supports {{CSSXRef("font-variant-alternates", "annotation()", "#annotation")}}.

Value

A {{domxref("CSSFontFeatureValuesMap")}} object.

Although the annotation property itself is read-only in the sense that you can't replace the CSSFontFeatureValuesMap object, you can still assign to the annotation property directly. You can also modify the values of the annotation using the CSSFontFeatureValuesMap instance methods.

Examples

Basic usage

CSS

css
@font-feature-values "MonteCarlo" {
  @annotation {
    my-annotations: 1;
  }
}

JavaScript

js
// look for the first stylesheet and the first cssRule in that sheet
const myRule = document.styleSheets[0].cssRules[0];
// check
if (myRule instanceof CSSFontFeatureValuesRule && myRule.annotation.size) {
  // do something with the annotation
}

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • {{cssxRef("@font-feature-values","@annotation","#annotation")}}
  • {{cssxRef("font-variant-alternates","annotation()","#annotation")}} functional notation
  • {{domxref("CSSFontFeatureValuesMap")}}