HTML DOM Style tabSize Property
THE WORLD'S LARGEST WEB DEVELOPER SITE

Style tabSize Property

❮ Style Object

Example

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, like <textarea> and <pre>, and the result of the tabSize property will only be visible for these elements.


Browser Support

Property
tabSize Yes Not supported Not supported
Use MozTabSize
6.1 15.0

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 8. Specifies the number of space-characters that should be displayed for each tab-character
length Specifies 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

Technical Details

Default Value: 8
Return Value: A String, representing the tab-size property of an element
CSS Version CSS3

Related Pages

CSS reference: tab-size property


❮ Style Object