CSS tab-sizeProperty

CSS Reference


Example

Set the tab-size of a <pre> element:

pre {tab-size: 16; }
pre {-moz-tab-size: 16; } /* Code for Firefox */
pre {-o-tab-size: 16; } /* Code for Opera */

Try it Yourself »

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

Currently only Chrome supports the tab-size attribute.

Firefox supports an alternative property to this one, namely the -moz-tab-size property.

Opera supports an alternative property to this one, namely the -o-tab-size property.

No browser currently supports this value as a length unit.


Definition and Usage

The tab-size property specifies the space length of tab characters.

In HTML, the tab character is usually displayed as a single space character, except in some elements such as <textarea> and <pre>, and the result of the tab-size property only applies to these elements.

Default value: 8
Inherited: Yes
Animatable: No. SeeAnimatable。
version: CSS3
JavaScript Syntax: object.style.tabSize="16" Try it Yourself


CSS Syntax

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

Property value

Value Description Testing
number The default value is 8. It specifies the number of space characters to be displayed for each tab character. Test »
length It specifies the length of the tab character. Almost all major browsers do not support this property value.
initial Sets this property to its default value. Seeinitial。 Test »
inherit Inherits this property from the parent element. Seeinherit。

CSS Reference

other extensions