Example
Set the tab-size of a <pre> element:
pre {-moz-tab-size: 16;} /* Code for Firefox */
pre {-o-tab-size: 16;} /* Code for Opera
10.6-12.1 */
pre {tab-size: 16;}
Try it Yourself »
Definition and Usage
The tab-size property specifies the length of the space used for the tab character.
In HTML, the tab character is usually displayed as a single space-character, except for some elements, like <textarea> and <pre>, and the result of the tab-size property will only be visible for these elements.
Default value: | 8 |
---|---|
Inherited: | yes |
Animatable: | no. Read about animatable |
Version: | CSS3 |
JavaScript syntax: | object.style.tabSize="16" Try it |
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Numbers followed by -moz- or -o- specify the first version that worked with a prefix.
Property | |||||
---|---|---|---|---|---|
tab-size | 21.0 | Not supported | 4.0 -moz- | 6.1 | 15.0 10.6 -o- |
Note: No browser is currently supporting the value as a length unit.
CSS Syntax
tab-size: number|length|initial|inherit;
Property Values
Value | Description | Play it |
---|---|---|
number | Default value 8. Specifies the number of space-characters that should be displayed for each tab-character | Play it » |
length | Specifies the length of a tab-character. This property value is not supported in any of the major browsers | |
initial | Sets this property to its default value. Read about initial | Play it » |
inherit | Inherits this property from its parent element. Read about inherit |