CSS properties - tab-size

revision:


tab-size property

- specifies the width of a 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 tab-size property will only be visible for those elements. .

CSS syntax : tab-size: number | length | initial | inherit;

Property values:

number : the number of space-characters to be displayed for each tab-character. Default value is 8

length : 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.

inherit : inherits this property from its parent element.

JavaScript syntax: object.style.tabSize="16"

example: tab-size property

The tab-size Property

                I	use	tab-size	4
                
                I	use	tab-size	16
                

Note: Firefox supports an alternative, the -moz-tab-size property.

code:
                    <div>
                        <h4>The tab-size Property</h4>
                        <pre id="t1">
                        I	use	tab-size	4
                        </pre>
            
                        <pre id="t2">
                        I	use	tab-size	16
                        </pre>
                        <p><strong>Note:</strong> Firefox supports an alternative, 
                        the -moz-tab-size property.</p>
                    </div>
                    <style>
                        #t1 {-moz-tab-size: 4; /* Firefox */ tab-size: 4;}
                        #t2 {-moz-tab-size: 16; /* Firefox */ tab-size: 16;}
                    </style>