CSS tab-size property

Definition and usage

The tab-size property specifies the width of the tab.

In HTML, tabs are usually displayed as a single space, except for certain elements (such as <textarea> and <pre>), and the result of the tab-size property is only visible for those elements.

Example

Set the tab width to 16 spaces:

pre {-moz-tab-size: 16;} /* Firefox */
pre {tab-size: 16;}

Try it yourself

CSS syntax

tab-size: number|length|initial|inherit;

Property value

Value Description
number Number of space characters to display for each tab. The default value is 8.
length Tab length. This property value is not supported by mainstream browsers.
initial Sets this property to its default value. See initial.
inherit Inherits this property from its parent element. See inherit.

Technical details

Default value: 8
Inheritance: Yes
Animation creation: Not supported. See:Animation-related properties.
Version: CSS3
JavaScript syntax: object.style.tabSize="16"

Browser support

The numbers in the table indicate the first browser version that fully supports this property.

Numbers with -moz- or -o- prefixes indicate the first version using the prefix.

Chrome IE / Edge Firefox Safari Opera
21.0 79.0 4.0 -moz- 6.1 15.0
10.6 -o-