CSSFontFeatureValuesRule: thuộc tính stylistic

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

Thuộc tính chỉ đọc stylistic của giao diện CSSFontFeatureValuesRule chứa một đối tượng CSSFontFeatureValuesMap đại diện cho định danh do người dùng xác địnhchỉ mục tính năng cho một font biến đổi hỗ trợ stylistic().

Giá trị

Một đối tượng CSSFontFeatureValuesMap.

Mặc dù bản thân thuộc tính stylistic là chỉ đọc theo nghĩa bạn không thể thay thế đối tượng CSSFontFeatureValuesMap, bạn vẫn có thể gán trực tiếp cho thuộc tính stylistic. Bạn cũng có thể sửa đổi các giá trị của stylistic bằng cách sử dụng các phương thức phiên bản của CSSFontFeatureValuesMap.

Ví dụ

Sử dụng cơ bản

CSS

css
@font-feature-values "MonteCarlo" {
  @stylistic {
    my-stylistics: 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.stylistic.size) {
  // do something with the stylistic
}

Thông số kỹ thuật

Specification
CSS Fonts Module Level 4
# dom-cssfontfeaturevaluesrule-stylistic

Tương thích trình duyệt

Xem thêm