如何使用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 老师订婚文案祝福语简短