tabSize Property - Javascript CSS Style Property

Javascript examples for CSS Style Property:tabSize

Description

The tabSize property gets and sets the size of the tab character.

Property Values

Value Description
number Default value 8. Set the number of space-characters used display tab-character
length Sets the length of a tab-character.
initial Sets this property to its default value.
inherit Inherits this property from its parent element.

Technical Details

Item Value
Default Value: 8
Return Value: A String, representing the tab-size property of an element
CSS VersionCSS3

Set the tabSize of a <pre> element:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<pre id="t1">
I  have  tabs  inside!
</pre>/*from w w w  . j  a va2  s  .  c  o  m*/

<button onclick="myFunction()">Test</button>

<script>
function myFunction() {
    document.getElementById("t1").style.MozTabSize = "16"; // Code for Firefox
    document.getElementById("t1").style.OTabSize = "16"; // Code for Opera 10.6-12.1
    document.getElementById("t1").style.tabSize = "16";
}
</script>

</body>
</html>

Related Tutorials