CSS tab-size Property


Example

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.

Show demo ❯

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 79.0 4.0 -moz- 6.1 15.0
10.6 -o-

Note: No browser is currently supporting the length unit value.


CSS Syntax

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

Property Values

Value Description Play it
number The number of space-characters to be displayed for each tab-character. Default value is 8 Demo ❯
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

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.