Can you apply formatting to table cell content in DITA?

Yes, you can apply formatting to table cell content in DITA using various mechanisms, including inline formatting, stylesheets, and CSS. This allows you to control the appearance and presentation of text and other content within the cells.

DITA allows you to apply formatting to table cell content to control how the text or elements within a cell are displayed. The main methods of formatting table cell content are inline formatting, stylesheets, and CSS classes.

Inline Formatting: Inline formatting allows you to apply styles to specific portions of text within a cell. You can use elements like <ph> (phrase) to apply styles such as bold, italics, or underline to text within a cell’s content.

Stylesheets: DITA-OT includes stylesheets that control the overall formatting of DITA content, including tables. By defining styles in these stylesheets or in custom CSS, you can change font styles, colors, cell padding, and other aspects of cell content. The styles can be applied to specific elements, cells, or entire tables.

CSS Classes: In addition to inline formatting and stylesheet-based formatting, you can use CSS classes to apply custom styles to cells or their content. Assign a class to a cell or specific elements within it, and define the corresponding styles in an external CSS file.


          This is a <ph conkeyref="b">bold</ph> and <ph conkeyref="i">italic</ph> text.

In this example, the <ph> elements with conkeyref attributes reference style definitions (e.g., “b” for bold, “i” for italic) that apply formatting to the corresponding text within the table cell content.