HTML DOM 스타일 textDecoration 속성
정의 및 사용
textDecoration 속성을 설정하거나 반환 하나 이상의 텍스트 장식입니다.
팁 : 소정 유형의 하나 이상의 요소를 수정해야하는 경우, 공백으로 구분 된 목록을 지정합니다.
문법
textDecoration 속성 설정 :
Object.style.textDecoration="none|underline|overline|line-through|blink|inherit"
위로 textDecoration 속성 :
Object.style.textDecoration
值 | 描述 |
---|---|
none | 默认。定义标准的文本。 |
underline | 定义文本下的一条线。 |
overline | 定义文本上的一条线。 |
line-through | 定义穿过文本的一条线。 |
inherit | textDecoration 属性的值从父元素继承。 |
브라우저 지원
모든 주요 브라우저는 textDecoration 속성을 지원합니다.
참고 : IE7 및 이전 버전은 "상속"값을 지원하지 않습니다.IE8은 "상속"지원!의 DOCTYPE을 제공합니다. IE9 지원 "상속".
예
예
장식 텍스트 :
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult(){
document.getElementById("p1").style.textDecoration="underline overline";
}
</script>
</head>
<body>
<p id="p1">这是一些文本。</p>
<br>
<button type="button" onclick="displayResult()">装饰文本</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult(){
document.getElementById("p1").style.textDecoration="underline overline";
}
</script>
</head>
<body>
<p id="p1">这是一些文本。</p>
<br>
<button type="button" onclick="displayResult()">装饰文本</button>
</body>
</html>
»시도
스타일 개체