33.4.6 Specifying attributes for table cells

To specify attributes for the <td> and <th> elements, you can use any of the following:

Paragraph format

Table format

Attribute PI marker.

Also see §33.6.5 Specifying row-group, row, and cell attributes with macros.

Paragraph format

If all the cells to which you want to assign a particular attribute or set of attributes contain text in a particular paragraph format, for example CellBody, you can use settings such as the following:

[HTMLParaStyles]
; CellAttribute inserts the contents of [StyleCellAttribute] into
;  the start tag of the enclosing table cell (ignored outside tables).
CellBody = CellAttribute
[StyleCellAttribute]
; doc style = attribute to insert in enclosing table cell start tag,
;   used in addition to other cell attributes given under [Table...]
CellBody = class="mycellstyle"

See §35.2.2.2 Assigning WAI attributes to paragraph formats. You can use a macro for the assignment in [StyleCellAttribute].

Table format

To base cell attributes on the table format:

[TableCellAttributes]
FormatA = class="mycellstyle"

See §33.6.5 Specifying row-group, row, and cell attributes with macros. You can use a macro for the assignment in [TableCellAttributes].

Attribute PI marker

To specify attributes for an individual cell, place a PI marker of type CellAttr inside the cell, where Attr is the name of the attribute. The marker content is just the attribute value, without quotes. For example, to assign a CSS class to an individual row, place a PI marker of type CellClass inside the cell, and make the marker content the name of the class. See §38.3 Adding attributes with PI markers.

Previous Topic:  33.4.5 Specifying attributes for table rows

Next Topic:  33.4.7 Eliminating automatically generated attributes

Parent Topic:  33.4 Specifying table attributes

Sibling Topics:

33.4.1 Specifying attributes for all tables

33.4.2 Overriding attributes for selected tables

33.4.3 Assigning a CSS class to a table

33.4.4 Using PI markers to assign attributes to tables, rows, or cells

33.4.5 Specifying attributes for table rows

33.4.7 Eliminating automatically generated attributes

33.4.8 Adjusting borders, cell spacing, and cell padding

33.4.9 Determining the width of table columns

33.4.10 Deciding what to do with empty paragraphs in table cells