Proposal: tab-size property

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.


Therefore....

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.

<length>
   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  
tab.
<percentage>
   Specifies a percentage width. The percentage is calculated with respect  
to the width of the generated box's containing block.
auto
   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  
presentation.
Like

code{
   tab-size: 4;/* unitless -> 4 spaces*/
}
pre{
   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  
inherit.

Thank you.

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