CSS 공백 속성
예시
white-space 속성의 다른 값을 보여줍니다.
p.a {
white-space: nowrap;
}
p.b {
white-space: normal;
}
p.c {
white-space:
pre;
}
정의 및 사용
속성 은 white-space
요소 내부의 공백을 처리하는 방법을 지정합니다.
브라우저 지원
표의 숫자는 속성을 완전히 지원하는 첫 번째 브라우저 버전을 지정합니다.
Property | |||||
---|---|---|---|---|---|
white-space | 1.0 | 8.0 | 3.5 | 3.0 | 9.5 |
CSS 구문
white-space: normal|nowrap|pre|pre-line|pre-wrap|initial|inherit;
속성 값
Value | Description | Play it |
---|---|---|
normal | Sequences of whitespace will collapse into a single whitespace. Text will wrap when necessary. This is default | |
nowrap | Sequences of whitespace will collapse into a single whitespace. Text will never wrap to the next line. The text continues on the same line until a <br> tag is encountered | |
pre | Whitespace is preserved by the browser. Text will only wrap on line breaks. Acts like the <pre> tag in HTML | |
pre-line | Sequences of whitespace will collapse into a single whitespace. Text will wrap when necessary, and on line breaks | |
pre-wrap | Whitespace is preserved by the browser. Text will wrap when necessary, and on line breaks | |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
관련 페이지
CSS 튜토리얼: CSS 텍스트
HTML DOM 참조: 공백 속성