标签尺寸 | tab-size (Text) - CSS 中文开发手册
这是一种实验技术
由于该技术的规格不稳定,请查看各种浏览器的兼容性表格以查阅用法。另外请注意,随着规范的变化,实验技术的语法和行为在未来版本的浏览器中可能会发生变化。
该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 value | 8 |
---|---|
Applies to | block containers |
Inherited | yes |
Media | visual |
Computed value | the specified integer or an absolute length |
Animation type | a length |
Canonical order | the unique non-ambiguous order defined by the formal grammar |
语法
可能值
<integer>——选项卡中的空格数。必须是非负的。
<length>——选项卡的宽度。必须是非负的。
形式语法
<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 */ }
规范
Specification | Status | Comment |
---|---|---|
CSS Text Module Level 3The definition of ‘tab-size‘ in that specification. | Working Draft | Initial definition |
浏览器兼容性
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | 211 | No support | 4.0 (2.0)-moz2 | No support | 10.60-o 151 | 6.1 |
<length> | 42 | No support | 53.0 (53.0)3 | No support | 29 | No support |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mini | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | 4.4 | 4.0 (2.0)2 | No support | 5-o | 11.5-o 24 | 7.1 |
<length> | 56 | 53.0 (53.0)3 | No support | No support | 37 | No support |