Thuộc tính định hướng văn bản CSS
Ví dụ
Đặt hướng văn bản cho các phần tử <div> khác nhau:
div.a {
text-orientation: mixed;
}
div.b {
text-orientation: upright;
}
Hãy tự mình thử »Định nghĩa và cách sử dụng
Thuộc tính text-orientation
chỉ định hướng của ký tự.
Lưu ý: Chỉ hoạt động khi chế độ viết được đặt thành dọc.
Giá trị mặc định: | Trộn |
---|---|
Thừa hưởng: | Đúng |
Hoạt hình: | KHÔNG. Đọc về hoạt hình |
Phiên bản: | CSS3 |
Cú pháp JavaScript: | đối tượng .style.textOrientation="thẳng đứng" Hãy thử nó |
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 | |||||
---|---|---|---|---|---|
text-orientation | 48.0 | 79.0 | 41.0 | 14.0 | 35.0 |
sideways (property value) |
Not supported | Not supported | 44.0 | Not supported | Not supported |
Cú pháp CSS
text-orientation: mixed|upright|sideways|sideways-right|use-glyph-orientation|initial|inherit;
Giá trị tài sản
Value | Description | Demo |
---|---|---|
mixed | Deafult value. Characters are rotated 90 degrees clockwise. | Demo ❯ |
upright | Characters are not rotated, but standing upright. | Demo ❯ |
sideways | Only supported in Firefox. Characters are orientated the same as the text lines are oriented with writing-mode vertical, 90 degrees clockwise. | |
sideways-right | Equal to property value sideways. Kept for compatibility purposes. | |
use-glyph-orientation | For use in SVG elements, so that text inherits deprecated SVG properties glyph-orientation-vertical and glyph-orientation-horizontal. | |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
Thêm ví dụ
Ví dụ
Thuộc tính text-orientation có thể được sử dụng để thay đổi hướng trong tiêu đề bảng:
th {
writing-mode: vertical-lr;
text-orientation: upright;
}
Hãy tự mình thử »Trang liên quan
Thuộc tính chế độ viết CSS: Thuộc tính Chế độ viết CSS