Thuộc tính kéo dài phông chữ CSS
Ví dụ
Làm cho văn bản trong 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 tính font-stretch
cho phép bạn làm cho văn bản hẹp hơn (rút gọn) hoặc rộng hơn (mở rộng).
Lưu ý: Một số phông chữ cung cấp các khuôn mặt bổ sung; các mặt cô đặc và các mặt mở rộng. Đối với những phông chữ này, bạn có thể sử dụng thuộc tính font-stretch
để chọn kiểu phông chữ bình thường, thu gọn 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ữ được chọn không có các mặt thu gọn hoặc mở rộng!
Giá trị mặc định: | Bình 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="expanded" |
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 |