The tab-size
CSS property is used to customize the width of tab characters (U+0009).
The tab-size
CSS property is used to customize the width of tab characters (U+0009).
/* <integer> values */ tab-size: 4; tab-size: 0; /* <length> values */ tab-size: 10px; tab-size: 2em; /* Global values */ tab-size: inherit; tab-size: initial; tab-size: revert; tab-size: revert-layer; tab-size: unset;
Initial value | 8 |
---|---|
Applies to | block containers |
Inherited | 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 */ }
This example compares a default tab size with a custom tab size. Note that white-space
is set to pre
to prevent the tabs from collapsing.
<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>
p { white-space: pre; } .custom { tab-size: 3; }
Specification |
---|
CSS Text Module Level 3 # tab-size-property |
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
tab-size |
21
This property is not yet animatable.
|
79
This property is not yet animatable.
|
91
4
Before Firefox 53, this property was not animatable.
|
No |
15
10.5-15
|
7 |
4.4 |
25
This property is not yet animatable.
|
91
4
Before Firefox 53, this property was not animatable.
|
14
11-14
|
7 |
1.5
This property is not yet animatable.
|
length |
42 |
79 |
53 |
No |
29 |
No |
56 |
42 |
53 |
29 |
No |
4.0 |
white-space
© 2005–2022 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/tab-size