텍스트 장식에서 라인 유형을 설정하려면 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>