Latest web development tutorials
 

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

Internet Explorer Firefox Opera Google Chrome Safari

The tabSize property is currently only supported in Chrome.

Firefox supports an alternative, the MozTabSize property.

Opera supports an alternative, the OTabSize property.

No browser is currently supporting the 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 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