|  | Home · All Classes · Main Classes · Grouped Classes · Modules · Functions |

[Previous: Common Rich Text Editing Tasks] [Contents]

# Supported HTML Subset

The following table lists the HTML tags supported by Qt's rich text engine:

Tag | Description | Comment
--- | --- | ---
`a` | Anchor or link | Supports the `href` and `name` attributes.
`address` | Address |
`b` | Bold |
`big` | Larger font |
`blockquote` | Indented paragraph |
`body` | Document body | Supports the `bgcolor` attribute, which can be a Qt color name or a `#RRGGBB` color specification.
`br` | Line break |
`center` | Centered paragraph |
`cite` | Inline citation | Same as `i`.
`code` | Code | Same as `tt`.
`dd` | Definition data |
`dfn` | Definition | Same as `i`.
`div` | Document division | Supports the standard block attributes.
`dl` | Definition list | Supports the standard block attributes.
`dt` | Definition term | Supports the standard block attributes.
`em` | Emphasized | Same as `i`.
`font` | Font size, family, and/or color | Supports the following attributes: `size`, `face`, and `color` (Qt color names or `#RRGGBB`).
`h1` | Level 1 heading | Supports the standard block attributes.
`h2` | Level 2 heading | Supports the standard block attributes.
`h3` | Level 3 heading | Supports the standard block attributes.
`h4` | Level 4 heading | Supports the standard block attributes.
`h5` | Level 5 heading | Supports the standard block attributes.
`h6` | Level 6 heading | Supports the standard block attributes.
`head` | Document header |
`hr` | Horizontal line | Supports the `width` attribute, which can be specified as an absolute or relative (`%`) value.
`html` | HTML document |
`i` | Italic |
`img` | Image | Supports the `src`, `source` (for Qt 3 compatibility), `width`, and `height` attributes.
`kbd` | User-entered text |
`meta` | Meta-information | If a text encoding is specified using the `meta` tag, it is picked up by Qt::codecForHtml(). Likewise, if an encoding is specified to QTextDocument::toHtml(), the encoding is stored using a `meta` tag, for example:
        <meta http-equiv="Content-Type" content="text/html; charset=EUC-JP" />
`li` | List item |
`nobr` | Non-breakable text |
`ol` | Ordered list | Supports the standard list attributes.
`p` | Paragraph | Left-aligned by default. Supports the standard block attributes.
`pre` | Preformated text |
`qt` | Qt rich-text document | Synonym for `html`. Provided for compatibility with earlier versions of Qt.
`s` | Strikethrough |
`samp` | Sample code | Same as `tt`.
`small` | Small font |
`span` | Grouped elements |
`strong` | Strong | Same as `b`.
`sub` | Subscript |
`sup` | Superscript |
`table` | Table | Supports the following attributes: `border`, `bgcolor` (Qt color names or `#RRGGBB`), `cellspacing`, `cellpadding`, `width` (absolute or relative), and `height`.
`tbody` | Table body | Does nothing.
`td` | Table data cell | Supports the standard table cell attributes.
`tfoot` | Table footer | Does nothing.
`th` | Table header cell | Supports the standard table cell attributes.
`thead` | Table header | Does nothing.
`title` | Document title | The value specified using the `title` tag is available through QTextDocument::metaInformation().
`tr` | Table row | Supports the `bgcolor` attribute, which can be a Qt color name or a `#RRGGBB` color specification.
`tt` | Typewrite font |
`u` | Underlined |
`ul` | Unordered list | Supports the standard list attributes.
`var` | Variable | Same as `i`.

## Block Attributes

The following attributes are supported by the `div`, `dl`, `dt`, `h1`, `h2`, `h3`, `h4`, `h5`, `h6`, `p` tags:

- `align` (`left`, `right`, `center`, `justify`)
- `dir` (`ltr`, `rtl`)

## List Attributes

The following attribute is supported by the `ol` and `ul` tags:

- `type` (`1`, `a`, `A`, `square`, `disc`, `circle`)

## Table Cell Attributes

The following attributes are supported by the `td` and `th` tags:

- `width` (absolute, relative, or no-value)
- `bgcolor` (Qt color names or `#RRGGBB`)
- `colspan`
- `rowspan`

[Previous: Common Rich Text Editing Tasks] [Contents]