CSS

标签尺寸 | tab-size

tab-size

这是一种实验技术

由于该技术的规格不稳定,请查看各种浏览器的兼容性表格以查阅用法。另外请注意,随着规范的变化,实验技术的语法和行为在未来版本的浏览器中可能会发生变化。

tab-sizeCSS属性用于定制选项卡(U+0009)字符的宽度。

/* <integer> values */ tab-size: 4; tab-size: 0; /* <length> values */ tab-size: 10px; tab-size: 2em; /* Global values */ tab-size: inherit; tab-size: initial; tab-size: unset;

Initial value8
Applies toblock containers
Inheritedyes
Mediavisual
Computed valuethe specified integer or an absolute length
Animation typea length
Canonical orderthe unique non-ambiguous order defined by the formal grammar

语法

可能值

<integer>——选项卡中的空格数。必须是非负的。

形式语法

<integer> | <length>

实例

pre {   tab-size: 4; /* Set tab size to 4 spaces */ }

pre {   tab-size: 0; /* Remove indentation */ }

pre {   tab-size: 2; /* Set tab size to 2 spaces */ }

规范

SpecificationStatusComment
CSS Text Module Level 3The definition of 'tab-size' in that specification.Working DraftInitial definition

浏览器兼容性

FeatureChromeEdgeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support211No support4.0 (2.0)-moz2No support10.60-o 1516.1
<length>42No support53.0 (53.0)3No support29No support

FeatureAndroidFirefox Mobile (Gecko)IE MobileOpera MiniOpera MobileSafari Mobile
Basic support4.44.0 (2.0)2No support5-o11.5-o 247.1
<length>5653.0 (53.0)3No supportNo support37No support