View Full Version : Watermark Script

12-18-2006, 08:17 PM
1) Script Title: Watermark Background Image Script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex3/fixback.htm

3) Describe problem:

I changed the script to a css:

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<style type="text/css">
#bgtable {
background:url('../images/header.jpg') white center no-repeat fixed;

I need it to work inside a table that I have:

<body bgcolor="#FFFFFF">
<div align="center">
<table id = "bgtable" border="0" cellspacing="0" width="700" bgcolor="#FFFFFF">
<td align=center colspan="2" width="100%"><p>&nbsp;<br>&nbsp; </p></td>
...much more table code...

I get the header.jpg image in the table, but it doesn't float like in the example on the watermark script page. The image I have is stationary in the exact center of the table and as it is a "tall" table I need to scroll to see more of the table, but the header.jpg is fixed in the center and moves up and down with the scroll.

How can I make the image float like in the watermark script example?


12-19-2006, 04:43 AM
For fixed backgrounds to have the dramatic 'always in view' effect that they can have, they must be attached as the background of the element that is being scrolled. In this case, that is most likely the body.

12-19-2006, 11:44 AM

The reason I attached it to the "table element" was because if I attached it to the body, then the table would "cover" it over and it would not be viewable behind the table.

Got any idea how to make the image viewable "thru" the table if it is attached to the body?

Or is having the image viewable thru the table a non-existant possibility?


12-19-2006, 04:18 PM
The background image on a page will be viewable through any element on the page that doesn't have its own 'background' (image or color) and that isn't itself over another intervening element that has one of these.

There are several ways that an element can acquire 'background', more so with tables. The one thing that is giving your table 'background' that I can see from your code in your first post is:

<table id = "bgtable" border="0" cellspacing="0" width="700" bgcolor="#FFFFFF">

There could be others not shown in that, probably not. If you cannot figure out why your table has 'background', I would need to see your full code, preferably by having a link to your page.