스타일 wordSpacing 속성
예시
<p> 요소에서 단어 사이의 간격을 50픽셀로 설정합니다.
document.getElementById("myP").style.wordSpacing = "50px";
정의 및 사용
wordSpacing 속성은 텍스트에서 단어 사이의 간격을 설정하거나 반환합니다.
팁: 텍스트에서 문자 사이의 간격을 설정하거나 반환하려면 letterSpacing 속성을 사용하십시오.
브라우저 지원
Property | |||||
---|---|---|---|---|---|
WordSpacing | Yes | Yes | Yes | Yes | Yes |
통사론
wordSpacing 속성을 반환합니다.
object.style.wordSpacing
wordSpacing 속성을 설정합니다.
object.style.wordSpacing = "normal|length|initial|inherit"
속성 값
Value | Description |
---|---|
normal | Defines normal spacing between words. This is default |
length | Specifies the space between words in length units. Negative values are allowed |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
기술적 세부 사항
기본값: | 정상 |
---|---|
반환 값: | 텍스트에서 단어 사이의 공백을 나타내는 문자열 |
CSS 버전 | CSS1 |
더 많은 예
예시
음수 값 사용:
document.getElementById("myP").style.wordSpacing = -3px";
예시
<p> 요소의 단어 간격을 반환합니다.
alert(document.getElementById("myP").style.wordSpacing);
예시
letterSpacing 속성과 wordSpacing 속성의 차이점:
function changeLetters() {
document.getElementById("myP1").style.letterSpacing = "15px";
}
function changeWords() {
document.getElementById("myP2").style.wordSpacing = "15px";
}
관련 페이지
CSS 튜토리얼: CSS 텍스트
CSS 참조: 단어 간격 속성
❮ 스타일 개체