English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

CSS Reference Manual

CSS @rules

Complete CSS Attributes

CSS3 tab-size attribute usage and example

CSS tab attribute-size is used to customize the tab (U+0009width.

The following table explains the usage and version history of this attribute, as well as the usage syntax of this attribute in the JavaScript script.

Default Value:8
Applies To:Block Container
Inheritance:Yes
Animatable:No.Please see Animation Attributes.
Version: CSS3new feature
JavaScript Syntax:object.style.tabSize="16"

tab-size syntax usage

The syntax of this attribute is as follows:

tab-size: integer | length | initial | inherit

The following examples demonstrate how to use tab-size attribute.

  pre {
      -moz-tab-size: 4; /* Firefox */
        -o-tab-size: 4; /* Opera */
           tab-size: 4; 
  }
Test See‹/›

Attribute Value

The following table describes the value of this attribute.

ValueDescription
integerSpecify the number of spaces in the tab. It must be a positive integer.
lengthSpecify the width of the tag as a length value (px, pt, cm, em, etc.), and negative length values are not allowed.
initialSet this attribute to its default value.
inheritIf specified, the associated element adopts the tab of its parent element.-The value of the size attribute.

Browser Compatibility

tab-Browser Compatibility of the size attribute, the numbers in the following table represent the minimum version number of the browsers that support this attribute; all mainstream browsers support this attribute.

  • Firefox 4+ -moz-

  • Google Chrome21+

  • Internet Explorer ×

  • Apple Safari 6.1+

  • Opera 10.6+ -o-,15+

Warning:tab-The size attribute is not supported by most browsers for the length value at present. It is best to avoid using length values.

Further Reading

Please refer to the following tutorials:CSS Text.

Related Attributes:white-space,word-spacing.