Properti dekorasi teks CSS
Contoh
Atur dekorasi teks yang berbeda untuk elemen <h1>, <h2>, dan <h3>:
h1 {
text-decoration: overline;
}
h2 {
text-decoration: line-through;
}
h3 {
text-decoration: underline;
}
h4 {
text-decoration: underline
overline;
}
Lebih banyak contoh "Coba Sendiri" di bawah ini.
Definisi dan Penggunaan
Properti text-decoration
menentukan dekorasi yang ditambahkan ke teks, dan merupakan properti singkatan untuk:
- text-decoration-line (wajib)
- teks-dekorasi-warna
- teks-dekorasi-gaya
Nilai bawaan: | tidak ada warna solid saat ini |
---|---|
Diwarisi: | tidak |
Animasi: | tidak, lihat properti individu . Baca tentang animasi |
Versi: kapan: | CSS1, diperbarui di CSS3 |
Sintaks JavaScript: | objek .style.textDecoration="garis bawah" |
Dukungan Peramban
Angka-angka dalam tabel menentukan versi browser pertama yang sepenuhnya mendukung properti.
Property | |||||
---|---|---|---|---|---|
text-decoration | 1.0 | 3.0 | 1.0 | 1.0 | 3.5 |
Sintaks CSS
text-decoration: text-decoration-line text-decoration-color
text-decoration-style|initial|inherit;
Nilai properti
Value | Description |
---|---|
text-decoration-line | Sets the kind of text decoration to use (like underline, overline, line-through) |
text-decoration-color | Sets the color of the text decoration |
text-decoration-style | Sets the style of the text decoration (like solid, wavy, dotted, dashed, double) |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Lebih Banyak Contoh
Contoh
Tambahkan lebih banyak dekorasi teks:
h1 {
text-decoration: underline overline dotted red;
}
h2 {
text-decoration: underline overline wavy
blue;
}
Halaman Terkait
Tutorial CSS: Teks CSS
Referensi DOM HTML: properti textDecoration