Our volunteers haven't translated this article into Tiếng Việt yet. Join us and help get the job done!
This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.
The tab-size
CSS property is used to customize the width of a tab (U+0009
) character.
Initial value | 8 |
---|---|
Applies to | block containers |
Inherited | yes |
Media | visual |
Computed value | the specified integer or an absolute length |
Animation type | discrete |
Canonical order | the unique non-ambiguous order defined by the formal grammar |
Syntax
/* <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: unset;
Values
<integer>
- The number of spaces in a tab. Must be nonnegative.
<length>
- The width of a tab. Must be nonnegative.
Formal syntax
<integer> | <length>
Examples
pre { tab-size: 4; /* Set tab size to 4 spaces */ }
pre { tab-size: 0; /* Remove indentation */ }
pre { tab-size: 2; /* Set tab size to 2 spaces */ }
Specifications
Specification | Status | Comment |
---|---|---|
CSS Text Level 3 The definition of 'tab-size' in that specification. |
Working Draft | Initial definition |
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 21 | 4.0 (2.0)-moz[1] | No support | 10.60-o 15 |
6.1 |
<length> |
42 | No support[2] | No support | No support | No support |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mini | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | 4.4 | ?[1] | ? | 5-o | 11.5-o 24 |
7.1 |
<length> |
? | ? | ? | ? | ? | ? |
[1] This feature is currently prefixed with -moz
. It will be unprefixed in bug 737785.
[2] Gecko doesn't implement this yet. See bug 943918.
See also
- Controlling size of a tab character (U+0009), an email by Anne van Kesteren to the CSSWG.