CSS tab-size
속성은 탭 문자(U+0009)의 너비를 조절합니다.
구문
/* <integer> 값 */
tab-size: 4;
tab-size: 0;
/* <length> 값 */
tab-size: 10px;
tab-size: 2em;
/* 전역 값 */
tab-size: inherit;
tab-size: initial;
tab-size: unset;
값
형식 정의
초기값 | 8 |
---|---|
적용대상 | block containers |
상속 | yes |
Computed value | the specified integer or an absolute length |
Animation type | a length |
형식 구문
예제
글자 수로 정의
pre {
tab-size: 4; /* Set tab size to 4 characters wide */
}
탭 제거
pre {
tab-size: 0; /* Remove indentation */
}
기본 크기와 비교
다음 예제는 기본 탭 크기를 사용자 지정 탭 크기와 비교합니다. white-space
속성을 pre
로 설정해서 탭 문자가 접히지 않도록 했습니다.
HTML
<p>no tab</p>
<p>	default tab size of 8 characters wide</p>
<p class="custom">	custom tab size of 3 characters wide</p>
<p> 3 spaces, equivalent to the custom tab size</p>
CSS
p {
white-space: pre;
}
.custom {
tab-size: 3;
-moz-tab-size: 3;
}
결과
명세
Specification | Status | Comment |
---|---|---|
CSS Text Module Level 3 The definition of 'tab-size' in that specification. |
Working Draft | Initial definition |
브라우저 호환성
BCD tables only load in the browser
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
같이 보기
- Controlling size of a tab character (U+0009), Anne van Kesteren이 CSSWG에 보낸 이메일.