Style tabSize Property

Style 对象参考手册Style Object

Examples

Set the tabSize of a <pre> element:

document.getElementById("myPRE").style.tabSize="16";

Try it yourself »

Definition and Usage

The tabSize 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 such as <textarea> and <pre>. The result of the tabSize property is only valid for these elements.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

Currently only Chrome supports the tabSize property.

Firefox supports another property that can replace this property, namely the MozTabSize property.

Opera supports another property that can replace this property, namely the OTabSize property.

Currently no browser supports this value as a length unit.


Syntax

Return the tabSize property:

object.style.tabSize

Set the tabSize property:

object.style.tabSize="number|length|initial|inherit"

Property Values

Value Description
number Default value is 8. Specifies the number of space characters to be displayed for each tab character.
length Specifies the length of the tab character. Almost all major browsers do not support this property value.
initial Set this property to its default value. Seeinitial。
inherit Inherit this property from its parent element. Seeinherit。

Technical Details

Default value: 8
Return value: A string representing the element's tab-size property.
CSS Version CSS3


Related Articles

CSS Reference:tab-size property


Style 对象参考手册Style Object

Other Extensions