Properti HTML DOM Style textShadow
Definisi dan Penggunaan
textShadow set properti atau mengembalikan satu atau lebih teks efek bayangan.
tatabahasa
Pengaturan properti textShadow:
Object.style.textShadow="none|h-shadow v-shadow blur color|inherit"
Catatan: textShadow atau atribut lebih tambahan untuk teks bayangan.Properti adalah daftar dipisahkan koma shadow, dan nilai opsional untuk setiap warna ditentukan oleh 2 atau 3 nilai panjang. Panjang nol dihilangkan.
Kembali sifat textShadow:
Object.style.textShadow
值 | 描述 |
---|---|
none | 默认。没有阴影绘制。 |
h-shadow | 必需。水平阴影的位置。可使用负值。 |
v-shadow | 必需。垂直阴影的位置。可使用负值。 |
blur | 可选。模糊距离。 |
color | 可选。阴影的颜色。在 CSS 颜色值 中寻找可能的颜色值的完整列表。 |
inherit | textShadow 属性的值从父元素继承。 |
Dukungan Browser
Semua browser utama mendukung properti textShadow, selain Internet Explorer.
contoh
contoh
Untuk menambahkan bayangan teks:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult(){
document.getElementById("p1").style.textShadow="5px 5px 1px #ff0000,10px 10px 1px #0000ff";
}
</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.textShadow="5px 5px 1px #ff0000,10px 10px 1px #0000ff";
}
</script>
</head>
<body>
<p id="p1">这是一些文本。</p>
<br>
<button type="button" onclick="displayResult()">添加文本的阴影</button>
</body>
</html>
Coba »
gaya Objects