W3C home > Mailing lists > Public > www-style@w3.org > September 2006

Proposal: tab-size property

From: Joao Eiras <joao.eiras@gmail.com>
Date: Wed, 13 Sep 2006 23:28:22 +0100
To: www-style@w3.org
Message-ID: <op.tft8pkiixl3at9@dragast.mshome.net>

I'd like to propose the tab-size property, which can have any positive  
length value in any unit, like percentages, em, ex, in, cm, px, ...
The property will only apply to elements which white-space is preserved,  
and it simply tells the length of a tab character \t; if the value has NO  
unit, then the parser will interpret the value as being the number of  
regular white-spaces (0x20) which compose the tab.


Name:            tab-size
Value:           <length> | <percentage> | auto | inherit
Initial:         auto
Applies to:      elements whit preserved white-space
Inherited:       yes
Percentages:     refer to width of containing block

This property efines the length of a regular tab character.

   Specifies a fixed width. If the width value has no unit, then the value  
will tell the number of regular white-spaces (0x20) needed to render the  
   Specifies a percentage width. The percentage is calculated with respect  
to the width of the generated box's containing block.
   The width depends on the values of other properties, like default UA  
behaviour or font.

Negative values are illegal.

This is useful when presenting programming code inside pre or code  
elements, and the original source contains trailing tabs for indentation.
I use 4 spaces tabs for my programming, but prefer 2 spaces tabs for  

   tab-size: 4;/* unitless -> 4 spaces*/
   tab-size: 2em;

All browser I've tested (Mozilla, Opera, IE) render a tab as 8  
white-spaces, which for me is too long. I'd like to control this.
If you feel specifying a <length> value for this property is a bit  
overkill, the value could then be simply a unitless length, auto and  

Thank you.
Received on Wednesday, 13 September 2006 22:28:31 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:26 UTC