##### 33.4.9.3 Maintaining the width of table columns via relative sizing

You can specify relative column widths for a table to override the widths specified in your DITA document, or if no widths are specified in DITA. Otherwise, use one of the settings described in §33.4.9.1 Specifying a method for determining table column widths, such as:

    [Tables]
    TableSizing = Percent

Suppose you have specified the following settings as defaults for all tables in your document:

    [Tables]
    TableSizing = Adaptive
    Border = 1
    Spacing = 0
    Padding = 4

And suppose for one particular table format, TwoCol, you want relative column widths:

    [TableSizing]
    TwoCol = Percent

This setting would make the width of each column in each TwoCol table a percent of the width of that particular table; but the setting would not specify the percentage.

If what you really want is for each TwoCol table to have columns of equal width, instead you would specify:

    [TableCellAttributes]
    TwoCol = width="50%"

Naturally, this setting works only if all TwoCol tables have exactly two columns.

To set the width of the table itself, you could add:

    [TableAttributes]
    TwoCol = width="100%"

This setting would eliminate your [Tables] settings for border, cellpadding, and cellspacing; so you would have to add them to the attribute list for TwoCol tables:

    [TableAttributes]
    TwoCol = width="100%" border="1" cellpadding="4" cellspacing="0"

See §33.4.2 Overriding attributes for selected tables.

Previous Topic: 33.4.9.2 Overriding the default table column sizing method

Next Topic: 33.4.10 Deciding what to do with empty paragraphs in table cells

Parent Topic: 33.4.9 Determining the width of table columns

Sibling Topics:

33.4.9.1 Specifying a method for determining table column widths

33.4.9.2 Overriding the default table column sizing method

Table of Contents • Index