如何使用JavaScript在文本装饰中设置行的类型?
要在文本装饰中设置行的类型,请使用textDecorationLine 属性。您可以尝试运行以下代码以使用JavaScript在文本修饰中返回行的类型-
示例
<!DOCTYPE html>
<html>
<body>
<div id = "myText" style = "text-decoration: underline;">
This is demo text.
</div>
<br>
<button onclick="display()"> Set Text Decoration </button>
<script>
function display() {
document.getElementById("myText").style.textDecorationColor = "red";
document.getElementById("myText").style.textDecorationLine = "overline";
}
</script>
</body>
</html>热门推荐
10 紫玫瑰生日祝福语简短
11 生完孩子祝福语简短
12 圣诞祝福语大全简短星座
13 小朋友得奖祝福语简短
14 长辈请客祝福语简短精辟
15 对转校同学祝福语简短
16 业主装修完成祝福语简短
17 过年红包祝福语简短霸气
18 冬日问候祝福语大全简短