PDA

View Full Version : Keeping an background image fixed within a table


triconanz
Sep 11, 2003, 10:10 PM
Is is possible to have a fixed background image within a table or a cell without tiling so that when the entire page is being scrolled, the text and the table scroll, but the image stays in the middle of the page the entire time?

If I want to insert an image in the background of a table and also want only the text to move but not the image... is there a way to do this?

Or would it be something that would have to be done using frames?

triconanz
Sep 11, 2003, 11:31 PM
So to add to my own question:

Are there any table attributes that will do the same as the following:

You can add this to the opening body statement:
<body bgproperties="fixed" background="images/background.gif">

bgproperties="fixed" is one way to do it. You can also use a style sheet - you place this before the </head>:

<style type="text/css">
BODY
{
background: white url('images/background.gif') fixed;
}
</style>

and if you want ths image only once & not tiled:
BODY
{
background: white url('images/backgrounds/generichdr.gif') fixed no-repeat;
}
</style>


The code above is used in a <body> tag. Is there something similar attributes that can be placed in a <table>, <tr>, or <td> tag?

coreybryant
Sep 12, 2003, 05:26 AM
]The code above is used in a <body> tag.
Actually this is also used in the <HEAD> within the style tag

You can try this:

<html>
<head>
<style type="text/css">
.tbl1
{
background: url('images/back.gif');
background-repeat: no-repeat;
}
</style>
</head>
<body>
<table border="1" cellpadding="0" cellspacing="0" width="100%" class="tbl1">
<tr>
<td width="100%"> </td>
</tr>
</table>
</body>
</html>