HTML DOM 스타일 wordSpacing 속성
정의 및 사용
속성을 wordSpacing하면 설정 또는 단어 사이의 공간에 텍스트를 반환합니다.
문법
wordSpacing 속성 설정 :
Object.style.wordSpacing="normal|length|inherit"
위로 wordSpacing 속성 :
Object.style.wordSpacing
值 | 描述 |
---|---|
normal | 默认。定义单词间的标准空间。 |
length | 使用 px、cm 等单位定义单词间的空间。可使用负值。 |
inherit | wordSpacing 属性的值从父元素继承。 |
브라우저 지원
모든 주요 브라우저는 wordSpacing 속성을 지원합니다.
참고 : IE7 및 이전 버전은 "상속"값을 지원하지 않습니다.IE8은 "상속"지원!의 DOCTYPE을 제공합니다. IE9 지원 "상속".
예
예
단어 사이의 간격을 변경합니다 :
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult(){
document.getElementById("p1").style.wordSpacing="50px";
}
</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.wordSpacing="50px";
}
</script>
</head>
<body>
<p id="p1">这 是 一 些 文 本。</p>
<br>
<button type="button" onclick="displayResult()">修改空间</button>
</body>
</html>
»시도
스타일 개체