FontFace: thuộc tính family
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.
Note: This feature is available in Web Workers.
Thuộc tính FontFace.family cho phép lấy hoặc đặt họ font của đối tượng FontFace.
Giá trị này được dùng để khớp tên với font face cụ thể khi áp dụng kiểu cho phần tử bằng thuộc tính font-family. Có thể dùng bất kỳ tên nào, tên này sẽ ghi đè lên tên được chỉ định trong dữ liệu font gốc.
Thuộc tính này tương đương với descriptor font-family của @font-face.
Giá trị
Một chuỗi.
Ví dụ
js
let fontFace = new FontFace(
"Roboto",
'url("https://fonts.example.com/roboto.woff2")',
);
console.log(fontFace.family); // 'Roboto'
fontFace.family = "newRoboto";
console.log(fontFace.family); // 'newRoboto'
Thông số kỹ thuật
| Thông số kỹ thuật |
|---|
| CSS Font Loading Module Level 3> # dom-fontface-family> |