Webmasters Tricks
*

My Tricks
Home Using "www2" Favicon Autodate Translation Tooltips Link Cloaking Track With 1 Pixel PHP Autodate SEO & Tables Screen Capture Website Scruffies Clever Subdomain Cloaking Trick PHP Includes Fancy Table Borders
My Tools
Private PLR Club Newbies School of Internet Marketing CheatKit Graphics Wizard CheatKit ListBuilder CheatKit Viral ListStorm Survey Convertor The Free Trial Machine ExitBlocker Cloak & Track Toolkit Forum Marketing Kit Scroller Control Newbies Starter Kit Ultimate Package Brander Affiliate PDF Brander Turbo Content SiteBuilder Content Rewriter Pro Grab That Sale! Web Protect Pro

Webmasters Cheat Kit - A Range Of Easy To Use Website ToolsThere are no "tricks" in my Private PLR Club - just the most outstanding value. Each month my Members get a ton of high-quality Private Label Rights products for a very low monthly subscription.

Click Here To See Everything You Get!

Tables With Fancy Borders

A common way to highlight something on a web page is a prominent box - sometimes called a "Johnson Box". It might look something like this:

This is a very dull looking box!

But, if you want to make it really stand out, you can easily add some color to the box, like this:

This looks a little better!

Mind you, the border looks rather horrible, doesn't it? Let's add a color to the border:

Getting a little smarter!

Let's look at the HTML for this box:

<table width="60%" border="1" align="center" cellpadding="10" cellspacing="0" bordercolor="#FF0000" bgcolor="#FFDFDF">
<tr>
<td>
Your text in here
</td>
</tr>
</table>

As you can see, I've used standard HTML to define the border color and the background color. I've also set the thickness of the border to "1"

Now lets get even fancier. How about this one:

Dotty round the edges!

So, how have I coded this box to get the dashed lines around the box. Here's the HTML:

<table width="60%" border="0" align="center" cellpadding="10" cellspacing="0" class="tborder2">
<tr>
<td>
Your text in here
</td>
</tr>
</table>

So, there's no apparent definition of the background color or the border color and thickness. Butwhat about that class="tborder2"?

I've used some CSS (Cascading Style Sheet) code to get this effect. All I've done is to put this code into the header section of the web page:

<style type="text/css">
<!--
.tborder2 {
background-color: #FFDFDF;
border: 2px dashed #FF0000;
}
-->
</style>

It's the CSS code which defines both the background color of the box and also what the border looks like. Even better, CSS means that you can have different styles of border. You are not just restricted to a solid line.

You can even have different styles of border around different edges of the box. Here's an extreme example, just to show you the different border effects you can get:

Going over the top!

Here's the CSS code for that crazy effect:

<style type="text/css">
<!--
.tborder3 {
background-color: #FFDFDF;
border-top-width: 3px;
border-right-width: 2px;
border-bottom-width: 4px;
border-left-width: 5px;
border-top-style: dotted;
border-right-style: double;
border-bottom-style: inset;
border-left-style: groove;
border-top-color: #FF0000;
border-right-color: #0000FF;
border-bottom-color: #996600;
border-left-color: #009900;
}
-->
</style>

Finally, let's use a sensible combination to make a Johnson Box which really does stand out:

Does this grab your attention?

Here's the CSS code:

<style type="text/css">
<!--
.tborder4 {
background-color: #FFDFDF;
border-top-width: 2px;
border-right-width: 4px;
border-bottom-width: 4px;
border-left-width: 2px;
border-top-style: dashed;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: dashed;
border-top-color: #FF0000;
border-right-color: #000000;
border-bottom-color: #000000;
border-left-color: #FF0000;
}
-->
</style>

If you use CSS like this and embed it in the header section of your page, you can use it to have the same design of box anywhere on the page. All you do is to put a "class" attribute for the CSS into your table HTML:

<table width="60%" border="0" align="center" cellpadding="10" cellspacing="0" class="tborder4">

Even better, if you define the CSS styles in a separate file, a "style sheet", you can use the styles anwhere on your website just by inserting code like this in the header of each page:

<link href="images/wt-style.css" rel="stylesheet"
type="text/css" />

.. where you state the name and folder where your style sheet is located.

If you want some excellent tutorials on CSS, I can recommend w3Schools.com There's a huge amount of advice and info there.

I hope you've found this useful.

Regards
Ian Traynor
Ian Traynor
Professional Webmaster

P.S. If you want to thank me for this "trick", here's a PayPal donations button. Click on it to pay me anything you like, using either your PayPal account or your credit card:

These "Webmasters Tricks" are presented without any guarantee that they will work on your website, on your computer or in your browser! As with any technology, you must test everything very carefully!

Ian Traynor is a professional webmaster and internet marketer. He owns the Webmasters CheatKit range of products, and produces the weekly "Marketing Update" newsletter. You can