CSS tab-size Property

You are Here:

CSS tab-size Property

CSS tab-size property is used to customize the width of a tab (U+0009) character.


HTML Online Editor
<!DOCTYPE html> <html lang="en-US"> <head> <style> #point{ tab-size: 4; -moz-tab-size: 4; /*Firefox*/ -o-tab-size: 4; /*Opera 10.6-12.1*/ } #point1{ tab-size: 16; -moz-tab-size: 16; /*Firefox*/ -o-tab-size: 16; /*Opera 10.6-12.1*/ } </style> </head> <body> <h1>CSS tab-size Property</h1> <h2>tab-size: 4</h2> <pre id="point"> tab-sizeis4. </pre> <h2>tab-size: 16</h2> <pre id="point1"> tab-sizeis16. </pre> </body> </html>


Using CSS

element{ tab-size: 16; }

Using Javascript



No, tab-size property is not animatable. CSS Animatable Properties Reference.

Default Value

Default value for CSS tab-size property is 8.

Property Value

The following table provides a list of values for CSS tab-size property.

NumberThe number of space-characters to be displayed for each tab-character.
lengthAllows you to define the border-image-width in any CSS length unit.

Using JavaScript

In the following example, we will demonstrate how to change the CSS tab-size property of an element using JavaScript.


HTML Online Editor
<!DOCTYPE html> <html lang="en-US"> <head> <style> pre{ tab-size: 4; -moz-tab-size: 4; /*Firefox*/ -o-tab-size: 4; /*Opera 10.6-12.1*/ } </style> </head> <body> <h1>CSS tab-size Property</h1> <pre> This is pre tag. </pre> <button onclick="myFunction()">Click Me</button> <script> var x = document.getElementsByTagName("pre")[0]; function myFunction(){ x.style.tabSize = "16"; x.style.MozTabSize = "16"; x.style.OTabSize = "16"; } </script> </body> </html>


Hi Developers, we almost covered 98.7% of CSS Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in CSS.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author