CSSFontFaceRule
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since Juli 2015.
Das CSSFontFaceRule-Interface repräsentiert eine @font-face At-Regel.
Instanz-Eigenschaften
Erbt Eigenschaften von seinem Vorfahren CSSRule.
CSSFontFaceRule.styleSchreibgeschützt-
Gibt eine
CSSStyleDeclarationzurück.
Instanz-Methoden
Erbt Methoden von seinem Vorfahren CSSRule.
Beispiele
Dieses Beispiel verwendet das CSS, das als Beispiel auf der Seite @font-face gefunden wurde. 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
Loading…