Home Teaching & Learning Servers & Network Home Teaching & Learning Servers & Network Teaching & Learning Home Servers & Network
Teaching & Learning Home Servers & Network Latest News
 
 
 

Web Publishing

<<< Wordpress CMS
Controlling page layout using a table in your blog
 
Background

Table in BlogThis page provides examples of the html code that you might need to include to insert a table in a Web 2.0 site (used for example to layout adjoining images as shown in the image on the right), using the html-editing feature of your blog site.

Of course, this is only required if your blog or Web 2.0 site doesn't provide a table insertion feature, or you are unable to install a table creation plugin.


How to.....

Shown below are some sample table layouts that may be useful in organising the layout of information on your blog page.

Choose the table layout that you would like to insert, then copy the html code from below that table configuration. Paste the code into the html area of your site's editing window. Replace the text Cell 1a, etc, with your content for that cell - text or pictures.

To enter the code below you will need to be in the html editing area of your blog. In WordPress, for example, click on the html tab in the page editing window:html tab

Using the parameters outlined below, you can vary the width of your table, the border thickness, the cell width, etc, by modifying the relevant html as detailed below.....

 
Table width (table width="500")
The example tables below are set to 500 pixels. Just change the number for a different width.

Table border (border="0")
The code below each table is written to display no borders (border=0). The actual examples shown below have their borders set to "1", for illustration purposes. To change the thickness of the borders, change this number.

Cell Width (td width="50%")
The width of each cell is set as a percentage of the width of the table. To vary this cell width, look for the code td width="50%", then simply change the percentage value to change the width of the cell.

Additional rows
Each row is defined by a <tr> tag to start the row, and a </tr> tag to complete the row, with <td> and </td> tags to define each cell across the row's columns.
For example (in a two column table) rows are created by:
<tr>
<td></td>
<td></td>
</tr>

A three column row would include an extra <td></td>
You can copy and paste the above part of the code for the relevant table to add additional rows to your table.

Alignment
The code below doesn't include any alignment information (left, right, centre). Use your blog's editing tools for text, picture and table alignment options.

Be aware though that once you have added additional html code to a blog page you may have to return to the html editing window to change some parts of your page - if the regular blog editing software doesn't "recognise" the html additions that you have made.

Of course, if you have some expertise in using other web editing software, you can create a layout using software such as DreamWeaver, then copy and paste the relevant html code to your blog.

Examples and associated html code
Example 1: Two Columns
Cell 1a Cell 1b
Cell 2a Cell 2b
Cell 3a Cell 3b


To produce the table above, copy the code below:

<table width="500" border="0">
<tr>
<td width="50%">Cell 1a</td>
<td width="50%">Cell 1b</td>
</tr>
<tr>
<td>Cell 2a</td>
<td>Cell 2b</td>
</tr>
<tr>
<td>Cell 3a</td>
<td>Cell 3b</td>
</tr>
</table>

 
Example 2: two data columns with a middle column for spacing between columns:
Cell 1a   Cell 1b
Cell 2a   Cell 2b
Cell 3a   Cell 3b


To produce the table above, copy the code below:

<table width="500" border="0">
<tr>
<td width="46%">Cell 1a</td>
<td></td>
<td width="46%">Cell 1b</td>
</tr>
<tr>
<td>Cell 2a</td>
<td></td>
<td>Cell 2b</td>
</tr>
<tr>
<td>Cell 3a</td>
<td></td>
<td>Cell 3b</td>
</tr>
</table>

 
Example 3: Three columns of equal width
Cell 1a Cell 1b Cell 1c
Cell 2a Cell 2b Cell 2c
Cell 3a Cell 3b Cell 3c


To produce the table above, copy the code below:

<table width="500" border="0">
<tr>
<td width="33%">Cell 1a</td>
<td width="33%">Cell 1b</td>
<td width="33%">Cell 1c</td>
</tr>
<tr>
<td>Cell 2a</td>
<td>Cell 2b</td>
<td>Cell 2c</td>
</tr>
<tr>
<td>Cell 3a</td>
<td>Cell 3b</td>
<td>Cell 3c</td>
</tr>
</table>

 

 
     
 
 
   
-