Latest web development tutorials

HTML DOM Style tabSize property

Style Object Reference Style Objects

Examples

Setting tabSize a <pre> element:

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

try it"

Definition and Usage

tabSize attribute specifies the length of the space tabs (tab) characters.

In HTML, the tabs (tab) characters are usually displayed as a single space character, except for some elements, such as <textarea> and <pre>, the result tabSize property is valid only for those elements.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Currently only supports Chrome tabSize property.

Firefox supports another alternative of the property attribute that MozTabSize property.

Opera supports another alternative of the property attribute that OTabSize property.

There is no browser supports this value as the unit of length.


grammar

Back tabSize properties:

object .style.tabSize

Setting tabSize properties:

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

Property Value

描述
number 默认值是 8。规定每个制表符(tab)字符要显示的空格字符的数量。
length 规定制表符(tab)字符的长度。几乎所有的主流浏览器都不支持该属性值。
initial 设置该属性为它的默认值。请参阅 initial
inherit 从父元素继承该属性。请参阅 inherit

technical details

Defaults: 8
return value: String representing the tab-size property element.
CSS version CSS3


related articles

CSS Reference Manual: the Tab-size property


Style Object Reference Style Objects