Table of Contents

This will create a simple table with a specific table width, specific column widths, a header row and borders around all the cells in the Wiki HTML Editor.

Paste the table contents below between the <body></body> tags of an html document at for a preview:

<!-- Change the properties for the table tag as listed below.  Default values for cellpadding -->
<!-- and cellspacing prevent border from appearing around all cells so set both to “0”. -->
<!-- Default value for table width will cause table width to be governed by table contents. -->
<!-- If your wiki article will contain multiple tables and you want to apply a consistent -->
<!-- width to all tables, set the table width value here and use that value for every table.-->

<table cellpadding="0" cellspacing="0" width="600" rules="all" style="border: #000000 thin solid;">

          <!-- Use the style attribute of the <tr> tag to set the background-color -->
          <!-- and font-weight of the first row to silver and bold, respectively. -->
          <!-- Use the valign attribute of the <tr> tag to set text alignment to "top". -->

          <tr style="background-color: silver; font-weight: bold;" valign="top">

                 <!-- Add columns to rows with the <td> tag and use the style -->
                 <!-- attribute to set the width for each column so that the sum -->
                 <!-- of all column widths equals the table width set above. -->

                 <td style="width: 400px">HeaderRow, Column1, Width is 400 pixels</td>
                 <td style="width: 200px">HeaderRow, Column2, Width is 200 pixels</td>

          <!-- Add rows as needed with <tr> tags. Columns will continue to use the -->
          <!-- widths set in the first row unless the number of columns per row changes -->
          <!-- so no need to keep setting column widths for this table.-->

                  <tr valign="top">
                  <td>Row2, Column1</td>
                  <td>Row2, Column2</td>
          <tr valign="top">
                   <td>Row3, Column1</td>
                   <td>Row3, Column2</td>

This table should render as follows:

HeaderRow, Column1, Width is 400 pixels HeaderRow, Column2, Width is 200 pixels
Row2, Column1 Row2, Column2
Row3, Column1 Row3, Column2

See Also

Other Languages

This article is also available in the following languages: