Properti HTML DOM Style textDecoration
Definisi dan Penggunaan
textDecoration set properti atau kembali satu atau dekorasi teks lebih.
Tip: Jika Anda perlu mengubah satu atau lebih elemen dari tipe yang telah ditentukan, menentukan daftar dipisahkan dengan spasi.
tatabahasa
Pengaturan properti textDecoration:
Object.style.textDecoration="none|underline|overline|line-through|blink|inherit"
Kembali sifat textDecoration:
Object.style.textDecoration
值 | 描述 |
---|---|
none | 默认。定义标准的文本。 |
underline | 定义文本下的一条线。 |
overline | 定义文本上的一条线。 |
line-through | 定义穿过文本的一条线。 |
inherit | textDecoration 属性的值从父元素继承。 |
Dukungan Browser
Semua browser utama mendukung properti textDecoration.
Catatan: IE7 dan versi sebelumnya tidak mendukung "mewarisi" nilai.IE8 hanya menyediakan! DOCTYPE didukung "mewarisi". dukungan IE9 "mewarisi".
contoh
contoh
teks dekoratif:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult(){
document.getElementById("p1").style.textDecoration="underline overline";
}
</script>
</head>
<body>
<p id="p1">这是一些文本。</p>
<br>
<button type="button" onclick="displayResult()">装饰文本</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult(){
document.getElementById("p1").style.textDecoration="underline overline";
}
</script>
</head>
<body>
<p id="p1">这是一些文本。</p>
<br>
<button type="button" onclick="displayResult()">装饰文本</button>
</body>
</html>
Coba »
gaya Objects