W3C WD-tabs-970117

Tab Stops for CSS

W3C Working Draft 17-Jan-1997

This version:
Latest version:
Dave Raggett <dsr@w3.org>

Status of this document

This is a W3C Working Draft for review by W3C HTML-ERB members. It will be made public immediately following a yes vote by the ERB.

Tab Stops for CSS

When it comes to converting documents created with word processors, HTML suffers from the lack of support for tab stops. Cumbersome work arounds can sometimes be found using HTML tables, but this abuses the value of markup and makes it harder for non-graphical user agents, e.g. for speech based browsers.

This is a proposal to extend CSS to support tab stops, using a a new property "tab-stops" which takes a space separated list of one or more tab stops. A horizontal tab character (ASCII decimal 9) in the document source then moves the output position to the next tab stop.

Instead of the tab char you could require an SGML entity or an element, e.g. <tab>, but the tab character seems the most natural choice.

Each tab stop specifies a position using a number followed by an optional units suffix, e.g. "1.5cm" is 1.5 centimetres. The units and their interpretation is as defined in CSS1. The length is measured from the left margin for left to right text, and from the right margin for right to left text. This direction is given by the base directionality for the text.

The number may be optionally preceded by a type indicator defining whether the tab stop provides left, center, right or decimal alignment, with the same interpretation as used by major word processors/desktop publishers. In the absence of such an indicator the type of the preceding tab stop is assumed. The default alignment is left for left to right text and right for right to left text.

Tab Alignment Indicators
leftLeft alignment
centerCenter alignment
rightRight alignment
decimalDecimal alignment


    tab-stops: decimal 1.5in  left 2.5in

This defines two tab stops, a decimal aligned tab stop at 1.5 inches and a left aligned tab stop at 2.5 inches.

    tab-stops: right 100%

This defines a single right aligned tab stop at the right hand margin (assuming a left to right text directionality). This useful when you want to align the rest of a text line with the right margin.

    tab-stops: decimal 5cm 10cm 15cm

This defines three decimal tab stops, and illustrates how the tab alignment is inherited from the preceding tab stop in the absence of an explicit alignment indicator.

Notes: the tab-stops property is not inherited, and the tab alignment indicator is case insensitive.

Tab leader characters

A solid, dotted or dashed line that fills the space taken by the tab character. You can use tab leader characters to create lines of periods, hyphens, or underscore characters in a document. Tab leader characters are an easy way to follow text with a horizontal line or to extend text only a certain distance between the margins.

To change the leader character insert one of the following keywords between the optional alignment and the position: blank, dotted, dashed, or lined (solid line), e.g.

     tab-stops: dotted 3in

The initial leader character for the tab rule is blank. The leader is inherited from the previous tab stop in the absence of an explicit leader character, e.g.

     tab-stops dotted 5cm 10cm blank 15cm

This sets the leader character to dotted for the tab stops at 5cm and 10cm and blank for the tab stop at 15cm. The keywords for the leader character are case insensitive.

Default Tab Stops

It makes sense for CSS to build on experience with tools that already support tabs, such as the major word processors/desktop publishers. In these products you always have a default tab rule (normally at 0.5in between tabs), and you always jump to the next tab stop. If such a stop is not available then you should jump to the next default tab stop.

The "tab-interval" property gives authors the ability to set the interval between default tab stops:

    tab-interval:  0.5in

Default tab stops are positioned at the integral multiples of this length from the left margin for a base directionality of left to right text, and the right margin for a base directionality of right to left text. The default alignment is left for left to right text and right for right to left text.

Skipped Tab positions

If the output position has already moved past the next tab stop, then a tab should move to the next available tab stop. This is the behaviour of the most commonly available word processors/desktop publishers. It is really up to the author to try and avoid these issues e.g. by positioning tab stops with sufficient slop and by selecting a matching font size. If the author needs greater flexibility then it may be more appropriate to use tables.

Note: a possibly better alternative is to move to the intended tab stop, but on the next textline below. This keeps the items positioned on their intended columns.

When Tab Stops should be Ignored

Tab stops should be ignored when the text alignment is other than left for a base directionality of left to right, and right for right to left text.

If text is not justified in the normal text direction manner (e.g: left for left to right and right for right to left) tabs must be treated as spaces. This is sensible enough - Microsoft Word does a very bad job of handling tabs in paragraphs that are not left justified.


The W3C Recommendation for Cascading Style Sheets
HTML 3.2
The W3C Proposed Recommendation for HTML 3.2