JavaScript에서 줄 스타일을 설정하려면 textDecorationStyle 재산. 선 스타일에 밑줄, 이중, 밑줄 등을 설정할 수 있습니다.
예시
다음 코드를 실행하여 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.textDecorationStyle = "double";
}
</script>
</body>
</html>