如何使用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 对儿童未来祝福语简短