Thuộc tính kéo giãn phông chữ CSS
Thí dụ
Làm cho văn bản trong các phần tử <div> rộng hơn:
div
{
font-family: sans-serif, "Helvetica Neue", "Lucida Grande", Arial;
font-stretch: expanded;
}
Định nghĩa và Cách sử dụng
Thuộc font-stretch
tính này cho phép bạn làm cho văn bản hẹp hơn (cô đọng) hoặc rộng hơn (mở rộng).
Lưu ý: Một số phông chữ cung cấp các mặt bổ sung; mặt đặc và mặt mở rộng. Đối với những phông chữ này, bạn có thể sử dụng thuộc font-stretch
tính để chọn một mặt phông chữ bình thường, cô đọng hoặc mở rộng.
Lưu ý: Thuộc tính này không có hiệu lực nếu phông chữ đã chọn không cung cấp các khuôn mặt cô đọng hoặc mở rộng!
Giá trị mặc định: | thông thường |
---|---|
Thừa hưởng: | Đúng |
Hoạt hình: | Đúng. Đọc về hoạt hình |
Phiên bản: | CSS3 |
Cú pháp JavaScript: | đối tượng .style.fontStretch = "mở rộng" |
Hỗ trợ trình duyệt
Các số trong bảng chỉ định phiên bản trình duyệt đầu tiên hỗ trợ đầy đủ thuộc tính.
Property | |||||
---|---|---|---|---|---|
font-stretch | 48.0 | 9.0 | 9.0 | 11.0 | 35.0 |
Cú pháp
font-stretch: ultra-condensed|extra-condensed|condensed|semi-condensed|normal|semi-expanded|expanded|extra-expanded|ultra-expanded|initial|inherit;
Giá trị tài sản
Value | Description |
---|---|
ultra-condensed | Makes the text as narrow as it gets |
extra-condensed | Makes the text narrower than condensed, but not as narrow as ultra-condensed |
condensed | Makes the text narrower than semi-condensed, but not as narrow as extra-condensed |
semi-condensed | Makes the text narrower than normal, but not as narrow as condensed |
normal | Default value. No font stretching |
semi-expanded | Makes the text wider than normal, but not as wide as expanded |
expanded | Makes the text wider than semi-expanded, but not as wide as extra-expanded |
extra-expanded | Makes the text wider than expanded, but not as wide as ultra-expanded |
ultra-expanded | Makes the text as wide as it gets |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |