الخميس، 28 مايو 2009

Html Table Codes

I’ll talk you through how to produce what I call a “Wikipedia style” table, the only table (really) worth producing; an elegant table with a fine border. I would not get involved with tables that have thick borders. When I see these I think novice etc.

You don’t need to know html table codes. It is useful to know what to look for but to write a table in html is pretty well pointless, in my opinion, as the html editors create great code for tables and the editors are free downloads. The following is an example of the code for a simple elegant table. The end result is shown below the code. Note: I am using simple html not CSS to produce sophisticated tables.

<table
style="text-align: left; background-color: rgb(204, 204, 204); width: 300px;"
border="0" cellpadding="2" cellspacing="1">
<tbody>
<tr>
<td
style="background-color: rgb(255, 255, 204); font-weight: bold; text-align: center;">This</td>
<td
style="background-color: rgb(255, 255, 204); font-weight: bold; text-align: center;">That</td>
</tr>
<tr>
<td
style="background-color: rgb(255, 255, 255); text-align: center;">One</td>
<td
style="background-color: rgb(255, 255, 255); text-align: center;">Two</td>
</tr>
</tbody>
</table>

Produces this:

This That
One Two

This can take on any number of variations (the table inside the box):


This That
One Two


This That
One Two

Or this:


This That
One Two

The code for the latter (the inner table portion) is:

<table
style="background-color: rgb(255, 255, 255); width: 100px; text-align: left; margin-left: auto; margin-right: auto;"
border="0" cellpadding="2" cellspacing="1">
<tbody>
<tr>
<td
style="text-align: center; font-weight: bold; background-color: rgb(102, 51, 102); color: rgb(255, 255, 204);">This</td>
<td
style="text-align: center; font-weight: bold; background-color: rgb(102, 51, 102); color: rgb(255, 255, 204);">That</td>
</tr>
<tr>
<td
style="text-align: center; background-color: rgb(51, 102, 102); color: rgb(153, 255, 153);">One</td>
<td
style="text-align: center; background-color: rgb(51, 102, 102); color: rgb(153, 255, 153);">Twoc</td>
</tr>
</tbody>
</table>


The strength of these tables for me is that they are elegant, look professional and easy to produce. But ironically the border setting for them all is always “0”. They have no border. The border is produced inside the cell spacing, by setting a difference between the table colour and the cell colours.

OK, so how do we produce tables like this at will and in an endless range of combinations? As I mentioned you don’t do it manually. But you need to know how to get the elegant fine line border and how to fill in the table with colour.

As mentioned, the underlying method is to create a table and paint in the table with a desired colour. The colour will be the colour of the border (note: remember there is no border, as the border is the colour in the cell spacing). The table should be given Spacing of one pixel (enter “1” against “Spacing”). The cells inside the table are then painted in a different colour. This will be the colour of the cells. When the cells are painted in, what remains of the colour selected for the table is just the border, all the rest is the cell colour.

The key is to use an html editor to give flexibility and speed. There are many free editors. I use NVU. It is a free download. Once downloaded it can be installed in the usual way. Here is the home page for NVU.

Once you have NVU installed (or any other html editor which should have the same facilities) you will usually write your webpage in it but if you simply want to write some html code to, for example, create elegant html table codes that is fine.

These are the steps employed in NVU to produce the above tables:

  1. Open a new page (click , “New”).
  2. Click, Insert>table>select the number of cells per chart.
  3. Double click on the table that is produced, which takes you to table properties.
  4. Select Table>Spacing>insert “1” (this means that in effect the “border” so produced will have a one pixel width, the finest possible border and the best in my opinion.
  5. Click Background Color and select the colour of the border. At this stage this will be selecting the table colour.
  6. Next there is a choice to colour in the cells. Either click “Cells” and go through each cell sequentially and select the appropriate colour or click OK, highlight the entire table and select the table or cell colour icon in the tool bar:

NVU-tool-bar

That is it. You will need some practice and experimentation obviously unless you know it all already! When the table is right for you go into the “Source” window and copy the page and paste it into the webpage that you are working on.

If you are working in the Blogger Blog compose mode window to write your post, the best way to transfer the table produced in NVU to your post is as follows (note: if you simply copy and paste the code the result is unacceptable):

  1. Save the table in NVU.
  2. Click on the browser icon.
  3. Copy the table by painting it in while in browser mode.
  4. Paste it into the compose mode window of Blogger.

Html table codes are all about working in a decent html editor and producing simple and elegant tables.

From Html Table Codes to Home Page

هناك 3 تعليقات:

  1. Why still use NVU when KompoZer is more up to date and better?

    ردحذف
  2. Hi, thanks for the comment. I had never heard of KompoZer until you told me! I'll give it a try immediately and report back!

    ردحذف
  3. PS. Another reason is that once you get settled with something you tend to stay with it as it lets you focus on page building rather than fiddling around learning new software.

    ردحذف

Your comments are always welcome.

Featured Post

i hate cats

i hate cats, no i hate f**k**g cats is what some people say when they dislike cats. But they nearly always don't explain why. It appe...

Popular posts