CSS tab-size Property

Set the width of the tab character to 16 spaces:

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

Try it Yourself »


Definition and Usage

The tab-size property specifies the width of a 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 those elements.

Default value: 8
Inherited: yes
Animatable: no. Read about animatable
Version: CSS3
JavaScript syntax: object.style.tabSize=”16″Try it

CSS Syntax

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

Property Values

Value Description
number The number of space-characters to be displayed for each tab-character. Default value is 8
length 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
inherit Inherits this property from its parent element. Read about inherit