Image Positioning

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Image Positioning

Post by Gen-ik »

I'm using CSS to add backgrounds to some TABLEs and TDs and know that they can be positioned using background-position: 100px 20px; etc.

My questions is can a background image be positioned relative to the documents top-left position?

It's a bit tricky to give an example :? but let's say that I want a background-image beind this message. Instead of having it's position relative to the top-left of this TD (which will be behind I'm using CSS), the image is positioned relative to the top-left of the document (which will be just above and to the left of PHP News somewhere).


Any help would be great on this one! :)
Rob the R
Forum Contributor
Posts: 128
Joined: Wed Nov 06, 2002 2:25 pm
Location: Houston

Post by Rob the R »

It can, but you must apply the "background-position" style to the BODY element instead of the TD element. You could try specifying negative pixels, but that doesn't seem like a good idea to me ,since you'd need to know where the TD element is relative to the page.
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

Hmmm. I understand what you mean. It will take a bit of re-laying out of some page elements but as I'm still working on the first page this shouldn't be too much of a problem... I hope!

Thanks for the suggestion. :)
Post Reply