IPOWERWEB.com

 Affordable, reliable
web hosting solutions

Call IPOWERWEB Today at 1-888-511-HOST Chat with an IPOWERWEB representative LIVE!
24/7x365 service - Live Technical Support

Domain Name Registration
web hosting services
cheap web hosting
IPOWERWEB help section
contact IPOWERWEB
testimonials for best hosting
affordable web hosting
IPOWERWEB web hosting
IPOWERWEB accolades
best domain prices


Web Hosting Money Back Guarantee
home build profit promote manage


Intermediate HTML Tutorial: Adding Colors and Backgrounds to Tables

Home > Build > Programming > HTML > Intermediate HTML Tutorial

2.4 Adding colors and backgrounds to tables

The tables we've been working with thus far look pretty bland. Luckily it's easy to add color to tables in the form of borders and backgrounds.

To give the border some color, all one has to do is define it in the opening <TABLE> tag:

<TABLE WIDTH="100%" BORDER="1" BORDERCOLOR="black">

This gives the same table we were working with a black border.

See it in the Browser

What if we wanted to give our table a background color? Applying backgrounds is identical to how one would specify colors in the <BODY> tag, with the BGCOLOR attribute. Table tags also use this attribute.

<TABLE WIDTH="100%" BORDER="1" BORDERCOLOR="black" BGCOLOR="white">

We now have a white table with a black border.

See it in the Browser

Images can also be used for a table's background. Images are used with the BACKGROUND attribute, just like the <BODY> tag.

<TABLE WIDTH="100%" BORDER="1" BORDERCOLOR="black" BACKGROUND="bluetile.gif">

See it in the Browser

Individual cells can also be given a background color or a background image in the same fashion. Instead of giving a color to the <TABLE> tag, give one to the <TD> tag for the cell you wish to have some color. In this example, we'll give the first column the white color and the last column will have the background image.

<TABLE WIDTH="100%" BORDER="1" BORDERCOLOR="black">
<TR>

<TD ALIGN="center" VALIGN="top" HEIGHT="123" BGCOLOR="white" >

Here we gave the first column the background color of white

<img src="../../../../blueback/bye.gif" width="200" height="36">
</TD>
<TD>&nbsp;
</TD>
<TD ALIGN="left" VALIGN="bottom" HEIGHT="123">
<img src="../../../../blueback/gallery.jpg" width="75" height="40">
</TD>
<TD ALIGN="right" HEIGHT="123" BACKGROUND="goldtile.gif">

Now we gave the last column the background image.

<img src="../../../../graphics/amazonhome.gif" width="90" height="68">
</TD>
</TR>
<TR>
<TD BGCOLOR="white">&nbsp;
</TD>
<TD>&nbsp;
</TD>
<TD>&nbsp;
</TD>
<TD BACKGROUND="goldtile.gif">&nbsp;
</TD>
</TR>
</TABLE>

See it in the Browser

 
home | products | about us | help center | testimonials | press room | contact us
affiliates | careers | domain names | web hosting | site map

Copyright © 1999-2007 IPOWER, Inc. Read our Terms and Conditions. All rights reserved.