Home > Article > Web Front-end > How to use css tab-size attribute
css tab-size attribute definition and usage
In css, the tab-size attribute is used to specify the tab character (tab) The space length of the character. In HTML, the tab character is usually displayed as a single space character. Except for some elements, such as
The tab-size attribute is a new attribute in css3. Currently, only the Chrome browser supports the tab-size attribute; the Firefox browser supports the -moz-tab-size attribute to replace this attribute; the Opera browser supports -o -tab-size attribute to replace this attribute. No browser supports this value as a length unit.
css tab-size attribute syntax format
css syntax: tab-size: number/length/initial/inherit
JavaScript syntax: object. style.tableLayout="fixed"
Attribute value says
number: Specifies the number of space characters to be displayed for each tab character (default value is 8)
length: Specifies the length of the tab character (almost all mainstream browsers do not yet support this attribute value)
initial: Set this attribute to its Default value
inherit: inherit the value of the tab-size attribute from the parent element
Example
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>css tab-size属性制表符的空格长度</title> <style type="text/css"> #t1{tab-size: 4; -moz-tab-size: 4; /*Firefox */ -o-tab-size: 4; /*Opera */ } #t2{tab-size: 8; -moz-tab-size: 8; /*Firefox */ -o-tab-size: 8; /* Opera */ } </style> </head> <body> <pre id="t1">I use tab-size 4
I use tab-size 16
目前只有Chrome支持 tab-size属性。
Firefox支持可替代该属性的属性-moz-tab-size属性。
Opera支持可替代该属性的属性-o-tab-size属性。
The above is the detailed content of How to use css tab-size attribute. For more information, please follow other related articles on the PHP Chinese website!