CSS tab-size property

CSS Reference CSS Reference


Examples

Set a <pre> element tab-size:

pre {tab-size: 16; }
pre {-moz-tab-size: 16; } /* 针对 Firefox 的代码 */
pre {-o-tab-size: 16; } /* 针对 Opera 的代码 */


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Currently only supports Chrome tab-size property.

Firefox supports another alternative of the property attribute that -moz-tab-size property.

Opera supports another alternative of the property attribute that -o-tab-size property.

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


Definition and Usage

tab-size property 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 results tab-size property is only valid for these elements.

Defaults: 8
inherit: Yes
Can be animated: no. Please refer to animation (Animatable) .
version: CSS3
JavaScript syntax: object .style.tabSize = "16"try


CSS Syntax

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

Property Value

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

CSS Reference CSS Reference