Search notes:

Graphviz: HTML like labels

If the value of an element's label attribute is delimited by angle brackets label = < … >, the value of the label is interpreted as HTML-like text where the following HTML tags and attributes are understood:
<b> <br/> <font> <hr> <i> <img> <o> <s> <sub> <sup> <table> <td> <tr> <u> <vr>
align
balign
bgcolor
border
cellborder
cellpadding
cellspacing
color
columns
face
fixedsize
gradientangle
height
href
id
point-size
port
rows
rowspan
scale
sides
src
style
target
tooltip
valign
width
xxx
Note: <img> is only allowed within <td>…</td>.

Text alignment in tables

The following example tries to demonstrate how text is aligned in tables.
The <td> elements should have the attribute align set to the value text. This ensures that the width of <td> one below the other have the same extension in both directions.
The alignment of the individual text portions are indicated with the align attribute within a closing <br/> tag.
digraph H {

  node [ shape=box fontname=Helvetica ]

  table [ label = <
    <table border="0">
       <tr><td align="text">By default, td text is center-aligned</td></tr>
       <tr><td align="text">This td is left aligned<br align="left" /></td></tr>
       <tr><td align="text">this one centered<br align="center" /></td></tr>
       <tr><td align="text">and this one right aligned<br align="right" /><br align="right"/></td></tr>
       <tr><td align="text">The value of a closing<br align="left"/>&lt;br/&gt; tag<br align="center"/>refers to the preceeding text<br align="right"/></td></tr>
    </table>
  > ]

}
Github repository about-Graphviz, path: /attributes/label/HTML-like/text-alignment-in-tables.dot

shape=plain

When using HTML like labels, it's probably a good thing to use shape=plain (which is equivalent to shape=none width=0 height=0 margin=0).

Index