如何使用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 高考祝福语 简短12字
14 孙媳妇祝福语简短
15 生日祝福语舅舅 简短独特
16 简短正能量生日祝福语
17 上级买车祝福语大全简短
18 简短的高考祝福语精选