CSS - tab-size
The tab-size
CSS property is used to customize the width of a tab (U+0009
) character.
Example
CSS
Copy Code
pre { tab-size: 4; /* Set tab size to 4 spaces */ }
CSS
Copy Code
pre { tab-size: 0; /* Remove indentation */ }
CSS
Copy Code
pre { tab-size: 99; /* Don't use tabs! */ }
Syntax
CSS
Copy Code
/* <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
CSS
Copy Code
<a href="css/integer" title=""><integer></a> <a href="css/value_definition_syntax#single_bar" title="Single bar">|</a> <a href="css/length" title="Possible values: a number followed by'em', 'ex', 'ch', 'rem', 'px', 'cm', 'mm', 'in', 'vh', 'vw', 'vmin', 'vmax', 'pt', 'pc' or 'px', like 3px, 1.5cm, -0.5em or 0"><length></a>
Description
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 |
Animatable | no |
Canonical order | the unique non-ambiguous order defined by the formal grammar |
Browser Compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 21 | 4.0 (2.0)-moz | No support |
10.60-o |
6.1 |
<length> | 42 | No support[1] | No support | No support | No support |
[1] 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.
Specifications
Specification | Status | Comment |
---|---|---|
CSS Text Level 3 The definition of 'tab-size' in that specification. |
Working Draft | Initial definition |
License
© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/css/tab-size