Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use the tab-size attribute in css

Shulou Source: shulou.com Published: 2022-06-01 12:16:00 10月04日 Update

This article will explain in detail how to use the tab-size attribute in css. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

Definition and usage of csstab-size attribute

In css, the tab-size attribute is used to specify the space length of a tab character. In HTML, a tab character is usually displayed as a single space character, except for some elements, such as and, the result of the tab-size attribute is valid only for these elements.

Tab-size attribute is a new attribute in css3. Currently, only Chrome browsers support tab-size attribute; Firefox browsers support-moz-tab-size attribute to replace this attribute; Opera browsers support-o-tab-size attribute to replace this attribute. No browser supports this value as a unit of length.

Csstab-size attribute syntax format

Css syntax: tab-size:number/length/initial/inherit

JavaScript syntax: object.style.tableLayout= "fixed"

Attribute value theory

Number: specifies the number of space characters to display for each tab character (default is 8)

Length: specifies the length of tab characters (this property value is not supported by almost all major browsers)

Initial: set this property to its default value

Inherit: inherits the value of the tab-size attribute from the parent element

Case study

The space length of the csstab-size property tab

# t1 {tab-size:4

-moz-tab-size:4;/*Firefox*/

-OmurtabMusizeVub 4itAccording to Opera /

}

# t2 {tab-size:8

-moz-tab-size:8;/*Firefox*/

-OmurtabMusizeGlu8 Tracer Compact Opera

}

Iusetab-size4

Iusetab-size16

Currently, only Chrome supports the tab-size attribute.

Firefox supports an alternative to this attribute-the moz-tab-size attribute.

Opera supports an alternative to this attribute-the o-tab-size attribute.

This is the end of this article on "how to use tab-size attributes in css". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.

Tags: Attributes support characters tabs browsers tabs browsing spaces length elements articles grammar only more good practical valid mainstream content units Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Apple Shulou Tech Info MySQL Linux