Free HTML and CSS for a Table Within a Post or Page

I used a 3-column, 7-row table in a recent post Why I Think Text Link Ads IS Better Than Google AdSense. If you would like to grab the HTML and CSS for it and adapt it to your own purposes – come and get it.

The Table

Here is a screenshot of the table I designed. It is made my inserting HTML into the post editor and inserting CSS into the Custom.css file.

table for post or page using HTML and CSSThe code for making this table is at the end of this post.

The Book That Makes It All Possible

I have a great book called, funnily enough, HTML XHTML & CSS, Sixth Edition – Visual Quickstart Guide by Elizabeth Castro.

It is absolutely fantastic for newbies to code and also those novice apprentices out there that can’t always remember the code.

html xhtml css book

  • It is very well indexed with lots of examples and pictures.
  • You can work your way through it and follow their examples to have a ‘play’ or you can refer to it when you need to, e.g. remembering the order of padding TRBL (top, right, bottom, left).
  • It has a great fold-out color code guide as well with swatches of colors and the hexadecimal values, e.g. White #FFFFFF.

color codesTable HTML

To insert a table like the one above, insert the following HTML code into your post editor amongst your article text.

<table cellspacing="0" cellpadding="0" width="100%" border="1" frame="border" rules="rows">
<tbody>
<tr>
<td><strong>Sidebar titles</strong></td>
<td><strong>First column title</strong></td>
<td><strong>Second column title</strong></td>
</tr>
<tr>
<td><strong>Left sidebar title</strong></td>
<td>First col text</td>
<td>Second col text</td>
</tr>
<tr>
<td><strong>Left sidebar title</strong></td>
<td>First col text</td>
<td>Second col text</td>
</tr>
<tr>
<td><strong>Left sidebar title</strong></td>
<td>First col text</td>
<td>Second col text</td>
</tr>
<tr>
<td><strong>Left sidebar title</strong></td>
<td>First col text</td>
<td>Second col text</td>
</tr>
<tr>
<td><strong>Left sidebar title</strong></td>
<td>First col text</td>
<td>Second col text</td>
</tr>
<tr>
<td><strong>Left sidebar title</strong></td>
<td>First col text</td>
<td>Second col text</td>
</tr>
<tr>
<td><strong>Left sidebar title</strong></td>
<td>First col text</td>
<td>Second col text</td>
</tr>
<tr>
<td><strong>Left sidebar title</strong></td>
<td>First col text</td>
<td>Second col text</td>
</tr>
<tr>
<td><strong>Left sidebar title</strong></td>
<td>First col text</td>
<td>Second col text</td>
</tr>
</tbody></table>

Table CSS

To style your table you will need to include the following CSS code into your custom.css (custom style sheet).

  • Change the colors, font, borders, widths, etc.
  • If you want more or less columns or rows, just delete or copy and paste the <td>ROW</td> or <tr>COLUMN</tr> – taking note the format and order of row and column breaks.
.tableleft {vertical-align: top; width:120px; margin:0; padding:4px 4px 6px 4px; border:1px #898989; background: #ececec; font-style: bold; font-family: Arial; font-size: 12px;}
.tablecenter {vertical-align: top; width:200px; margin:0; padding:4px 4px 6px 4px; border:1px #898989; background: #ffffff; font-family: Arial; font-size: 12px;}
.tableright {vertical-align: top; width:200px; margin:0; padding:4px 4px 6px 4px; border:1px #898989; background: #ececec; font-family: Arial; font-size: 12px;}

Another Example of a Table

I adapted the above code to create a different table for the post 100 Reasons Why Blogussion is an Amazingly Successful Site (Part 1). Screenshot below…

table extract from blogussion article

Show Us Your Table

If you do use this code as is, or adapt it to make your own table, come back and leave a link to your post.

{ 15 comments… read them below or add one }

baloot December 29, 2009

nice css table… i want to make it more rounded border by using css3… :)
.-= baloot´s last blog ..Download Wallpaper Ubuntu Percuma =-.

Reply

Somone Bull December 29, 2009

There’s a lot of chatter out there about whether to use tables or not. I would suggest using them sparingly and when they really do assist with your layout. As for round corners, there are some css tips I found but not sure what I’m doing to advise. Apparently, Firefox and Safari are good to go with rounded corners using css but IE and some other browsers still won’t play nice.

I’ll wait for some other savvy commenters to advise, like George…?

Reply

baloot December 29, 2009

i’ve got new smashingmagazine book. it’s was awesome too.. that book tells me about designing (but in not very details). havn’t finish reading yet. :)

thesisthemehq was my source about thesis theme.. from this blog i found related articles to make here and there tweaks for thesis.
.-= baloot´s last blog ..Download Wallpaper Ubuntu Percuma =-.

Reply

sürücü kursu December 29, 2009

thanks for share.

Reply

TechChunks January 12, 2010

Nice looking CSS table. I’m sure I’m going to use one similar to this in one of my upcoming posts. Thanks :)
.-= TechChunks´s last blog ..An Affordable $199 Tablet. And It’s Not From Apple =-.

Reply

Andy Walpole January 13, 2010

The Visual Quickstart books are brilliant. I took the bulk of my knowledge about PHP from two of their books. Also as well the Lynda DVD tutorials are great for learning aspects of design and development.
.-= Andy Walpole´s last blog ..The internet 10 years ago this month – January 2000 =-.

Reply

peterkizumaki June 10, 2010

I used it for my site. That’s cool. Thanks so much for your sharing !
.-= peterkizumaki´s last blog ..The Customer Loyalty Solution (Paperback) =-.

Reply

lucas July 4, 2010

Can i use it within blogger posts ????

Reply

Somone Bull July 4, 2010

Yes. It’s just HTML. However, the css will have to be added to your Blogger style sheet. I’m not sure if you have access to that. I am a dedicated WordPress fan.

Reply

Gulam Ali December 16, 2010

Thanks for the effort you took to expand upon this post so thoroughly.
Why valid html code is important to your web site’s search engine optimization efforts and consequent high rankings! Such invalid html codes… A single missing bracket in your html code can be the cause your web page cannot be found in search engines… Providentially, there are free services that allow you to check and fix the validity of your html codes.

Reply

Terri Ann June 7, 2011

I know this is an old post but I’d recommend revisiting the table structure to use


<thead>
<tr>
<th><strong>Sidebar titles</strong></th>
<th><strong>First column title</strong></th>
<th><strong>Second column title</strong></th>
</tr>
</thead>
<tbody>

Great post!

Reply

Somone Bull June 7, 2011

Thanks Terri. Code does change over time. greatfl that you have offered an update.

Reply

Boyd Carter December 3, 2011

Hello Somone,

I was looking for a table to use in a text widget for a sidebar and came across your post. I will try it and let you know how it works.

I also have the sixth edition of Elizabeth Castro’s book and couldn’t survive without it. If you order it from her blog ( http://www.elizabethcastro.com/ ) you get a 34% discount on it from Amazon.

Finally, do you plan to ever turn on Commentluv again?

Boyd

Reply

Somone Bull December 4, 2011

Hi Boyd.
Hope it is helpful. Thanks for the tip on the HTML/CSS bible.
Not sure about CommentLuv at the moment. I will reconsider in early 2012. I had some issues with my CPU usage and had to disable many plugins so my hosting provider didn’t chop me off!
Tell me, is your business model profitable?

Reply

Boyd Carter December 5, 2011

Is my business model profitable? Ha!

My website is 2 months old, and just beginning to get visitors. Time will tell. The number of visitors has increased since adding commentluv premium. It think that is a good sign.

Another plus of commentluv premium is the spam module. Forget akismet, go with commentluv premium.

Reply

Leave a Comment

Previous post:

Next post: