WordPress – Basic Table Template


Overview

I’ve started using some basic tables on another WordPress blog and so I thought I would post a basic template here for future reference.

Table 1 Title.
Heading 1 Heading 2
One Two
Three Four
Five Six

Sample Code

Copy, paste and edit this code inside a Custom HTML block in WordPress:

<div  align="center">
<figcaption><strong>Table 1</strong> Title.</figcaption>
<table align="center">
  <tbody><tr>
    <th>Heading 1</th>
    <th>Heading 2</th> 
  </tr>
  <tr>
    <td align="left">One</td>
    <td align="left">Two</td>
  </tr>
  <tr>
    <td align="left">Three</td>
    <td align="left">Four</td>
  </tr>
  <tr>
    <td align="left">Five</td>
    <td align="left">Six</td>
  </tr>
</tbody>
</table>
</div>

Tags

Table 2 gives a brief description of the tags used in my HTML tables.

Table 2 HTML Tags.
HTML Tag Description
<figcaption> Table title (optional).
<div> Added to center the table title (optional).
<table> Creates a table.
<tr> Start a new table row.
<th> Adds table heading.
<td> Adds table data.

Special Characters

In Table 2 I used the following special characters to format the HTML tags so that they would not be read as HTML code by WordPress.

Table 3 HTML Special Characters.
Code Description
&lt; Less than
&gt; Greater than

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s