Set the tabSize of a <pre> element:
document.getElementById("myPRE").style.tabSize = "16";
Try it Yourself »
The tabSize property specifies the length of the space used for the tab character.
In HTML, the tab character is usually displayed as a single space-character, except for some elements, like <textarea> and <pre>, and the result of the tabSize property will only be visible for these elements.
Property | |||||
---|---|---|---|---|---|
tabSize | Yes | 79.0 | Not supported Use MozTabSize |
6.1 | 15.0 |
Return the tabSize property:
object.style.tabSize
Set the tabSize property:
object.style.tabSize
= "number|
length|initial|inherit"
Value | Description |
---|---|
number | Default value 8. Specifies the number of space-characters that should be displayed for each tab-character |
length | Specifies the length of a tab-character. This property value is not supported in any of the major browsers |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Default Value: | 8 |
---|---|
Return Value: | A String, representing the tab-size property of an element |
CSS Version | CSS3 |
CSS reference: tab-size property
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!