font-variant

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.

Thuộc tính font-variant cho biết văn bản sẽ được hiển thị bằng các biến thể của các glyph của phông chữ hay không.

Note: Với vai trò là một presentation attribute, font-variant cũng có thuộc tính CSS tương ứng: font-variant. Khi cả hai đều được chỉ định, thuộc tính CSS sẽ được ưu tiên.

Bạn có thể dùng thuộc tính này với các phần tử SVG sau:

Ví dụ

Kiểm soát biến thể phông SVG

html
<svg viewBox="0 0 250 30" xmlns="http://www.w3.org/2000/svg">
  <text y="20" font-variant="normal">Văn bản thường</text>
  <text x="100" y="20" font-variant="small-caps">Văn bản chữ hoa nhỏ</text>
</svg>

Lưu ý sử dụng

Giá trị

normal | none | [ <common-lig-values> || <discretionary-lig-values> || <historical-lig-values> || <contextual-alt-values> || stylistic( <feature-value-name> ) || historical-forms || styleset( <feature-value-name># ) || character-variant( <feature-value-name># ) || swash( <feature-value-name> ) || ornaments( <feature-value-name> ) || annotation( <feature-value-name> ) || [ small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps ] || <numeric-figure-values> || <numeric-spacing-values> || <numeric-fraction-values> || ordinal || slashed-zero || <east-asian-variant-values> || <east-asian-width-values> || ruby ]

Giá trị mặc định normal
Có thể animate

Để biết mô tả về các giá trị, vui lòng tham khảo thuộc tính CSS font-variant.

Thông số kỹ thuật

Thông số kỹ thuật
CSS Fonts Module Level 4
# font-variant-prop
Scalable Vector Graphics (SVG) 2
# FontVariantProperty

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

Xem thêm