Copyright © tutorialspoint.com

# Html Background Images

The background attribute can also be used to control the background of an HTML elmement, specifically page body and table backgrounds. You can specify an image to set background of your HMTL page or table. Following is the syntax to use background attribute with any HTML tag.

The background is deprecated and it is recommended to use Style Sheet for background setting.

    <tagname background="Image URL"...>

## Example:

Here are the examples to set background images of a table.

    <!-- How to set a table background -->
    <table background="/images/html.gif" width="100%"  height="100">
    <tr><td>
    This background is filled up with HTML image.
    </td></tr>
    </table>

    <table background="/images/home.gif" width="100%"  height="100">
    <tr><td>
    This background is filled up with home image.
    </td></tr>
    </table>

This will produce following result:

This background is filled up with HTML image.

This background is filled up with home image.

Note that when your HTML element is larger than the dimensions of your picture, the image simply begins to repeat itself.

To Become more comfortable - Do Online Practice

Copyright © tutorialspoint.com