Adding Background Images to Tables

Navigation

Sponsors

Save this to Del.icio.us

Adding Background Images to Tables

Adding background images to tables and it's cells can make a table look more interesting, although it is not always recommended as it could make the table look untidy.

A background image can be added by using the "BACKGROUND" attribute. This attribute can be placed within the <table> tag to give the whole table a background image, or within the <tr>, <th> or <td> tags to give that specific row or cell a background image.

For example:

<table background = "images/exampleBG.png">
  <tr>
    <td>
      <p>This code here...</p>
    </td>
  </tr>
</table>

...would give this table

There are 2 things that you should keep in mind about adding a background image to a table. First of all the background image of a table is automatically repeated horizontally and vertically to fill out the space specified (table, row or cell). Second of all the attribute is defined in the form 'background = "x"', where x is the location of the image. This can be done relatively, i.e. with respect to the location of the current file (like in the example above), or absolutely, e.g. "http://www.domain.com/images/image.png".


[ Back to HTML Tutorials ]


Forums | Search | Donate | Links | Contact | Templates | Privacy Policy
Copyright © 2012 SiteToolCenter.com

Website Design

Best Viewed With Mozilla FireFox