CSSFontFaceRule

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Das CSSFontFaceRule Interface repräsentiert eine @font-face At-Regel.

CSSRule CSSFontFaceRule

Instanz-Eigenschaften

Erbt Eigenschaften von seinem Vorfahren CSSRule.

CSSFontFaceRule.style Schreibgeschützt

Gibt eine CSSStyleDeclaration zurück.

Instanz-Methoden

Erbt Methoden von seinem Vorfahren CSSRule.

Beispiele

Dieses Beispiel verwendet das CSS, das als Beispiel auf der Seite von @font-face zu finden ist. Die erste zurückgegebene CSSRule wird eine CSSFontFaceRule sein.

css
@font-face {
  font-family: MyHelvetica;
  src:
    local("Helvetica Neue Bold"), local("HelveticaNeue-Bold"),
    url(MgOpenModernaBold.ttf);
  font-weight: bold;
}
js
const myRules = document.styleSheets[0].cssRules;
console.log(myRules[0]); // A CSSFontFaceRule

Spezifikationen

Specification
CSS Fonts Module Level 4
# om-fontface

Browser-Kompatibilität