Thuộc tính dấu gạch nối CSS
Ví dụ
Đặt các dấu gạch nối khác nhau:
<style>
div.a {
hyphens: none;
}
div.b {
hyphens: manual;
}
div.c {
hyphens: auto;
}
</style>
<body>
<h2>hyphens:
none</h2>
<div class="a">A veryvery­very long word.</div>
<h2>hyphens: manual</h2>
<div class="b">A veryvery­very long
word.</div>
<h2>hyphens: auto</h2>
<div class="c">A
veryvery­very long word.</div>
</body>
Hãy tự mình thử »Định nghĩa và cách sử dụng
Thuộc tính hyphens
xác định liệu dấu gạch nối có được phép tạo ra nhiều cơ hội ngắt dòng mềm hơn trong một dòng văn bản hay không.
Giá trị mặc định: | thủ công |
---|---|
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.hyphens="none" |
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 | |||||
---|---|---|---|---|---|
hyphens | 55.0 | 79.0 10.0 -ms- |
43.0 | 17.0 5.1 -webkit- |
44.0 |
Cú pháp CSS
hyphens: none|manual|auto|initial|inherit;
Giá trị tài sản
Value | Description | Demo |
---|---|---|
none | Words are not hyphenated | Demo ❯ |
manual | Default. Words are only hyphenated at ‐ or ­ (if needed) | Demo ❯ |
auto | Words are hyphenated where the algorithm is deciding (if needed) | Demo ❯ |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |