Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript: fixed position background image

Status
Not open for further replies.

tjd

IS-IT--Management
Nov 5, 2002
126
GB
Can anyone remember the fragment of code for fixing an image to the centre of the background of a page, so you can get the effect of a fixed watermark while the foreground text appears to scroll over it?

I swear I had the pesky little @#!@# somewhere...but I can't find it; hell it doesn't go more'n about 4 lines of code so its probably rolled under the CD drive somewhere, and what with the alzhiemers and all, I can't remember how it goes fr the life of me... Will someone help an old josser out? - "Oops! I've joined a club that'll have me as a member?" -
 
CSS solution

Code:
<style>
<!--
  body {
    background : URL of background image;
    background-repeat : no-repeat;
  }
-->
</style>

Cheech The secret of life is honesty and fair dealing. If you can fake that, you've got it made.
Groucho Marx (1895-1977)
 
Tks much. - &quot;Oops! I've joined a club that'll have me as a member?&quot; -
 
Thanx again, Cheech. That CSS is an easy way to do it, hey? If you want the thing to stick centre and appear site wide you need this in the sheet:

BODY {
background:URL(../images/name.gif);
background-attachment:fixed;
background-position: center;
...etc

won't do it on a single line fr some reason.

[2thumbsup] - &quot;Oops! I've joined a club that'll have me as a member?&quot; -
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top