SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Dec 2000
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, this is my first post in this forum. I am pretty much a beginner, and your help is appreciated. I have created a website for my band, and I want the image on the index page to be fixed so that it does not tile with increased pixel settings. I have used the following javascript, but it will not work with netscape - msie is no problem. Can someone tell me how to make it work with both browsers, or maybe suggest a different approach?

    <script language="JavaScript1.2">

    if (document.all)
    document.body.style.cssText="background:black url(images/Ilikethis.jpg) no-repeat fixed center center"

    </script>

    my website is: http://www.voxanova.com

    Thanks, Gary.


  2. #2
    SitePoint Zealot cckrocks's Avatar
    Join Date
    Nov 2000
    Location
    A home in the hills where the grass grows green an
    Posts
    183
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The official way to do a static background is with style sheets. Here is the code:

    <style>
    body {
    background-image: url("yourimage.gif");
    background-repeat: no-repeat;
    background-attachment: fixed;
    }
    </style>

    You can use these basic values for positioning:

    top left
    top center
    top right
    center left
    center center
    center right
    bottom left
    bottom center
    bottom right

    You can also use absolute positioning with x and y axis values, but these basic values are usually more than enough.
    Think beyond what is common...
    www.jaggedknife.com
    www.fusion-in.com

  3. #3
    SitePoint Zealot cckrocks's Avatar
    Join Date
    Nov 2000
    Location
    A home in the hills where the grass grows green an
    Posts
    183
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That code would be inserted in between the <head></head> of the document. Also, by looking at your site, I would suggest that you tone down your background color with some opacity to make the rest of the website more visible, otherwise you run into problems having trouble reading some of the text depending on where it lies on the screen.
    Think beyond what is common...
    www.jaggedknife.com
    www.fusion-in.com

  4. #4
    SitePoint Member
    Join Date
    Dec 2000
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the help, I'll give it a try.

  5. #5
    Don't get too close, I bite! Nicky's Avatar
    Join Date
    Jul 1999
    Location
    Lancashire, UK
    Posts
    8,277
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Gary, please realise that this effect will not work on all browsers, so it is best to test and make sure that your site is still usable if the background does scroll!

  6. #6
    SitePoint Member
    Join Date
    Dec 2000
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nicky,

    I am trying to make the background image fixed, and not tile when the pixel settings are high. I want a certain look and it is messed up if the image tiles. I know that certain techniques are not compatiple with all browsers, but isn't it most important to get it right with msie and netscape. I am probably ignorant about this, but it seems that the people I know use one of the two. Also, I have seen sites get the effect I am looking for by cutting the image into several pieces and arranging them in a table. This is way beyond my experience in image editing, but I have been looking for information on how to accomplish it.

    Thanks for your reply.

  7. #7
    SitePoint Enthusiast smirk's Avatar
    Join Date
    Dec 2000
    Location
    gibraltar ... for now...
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use the CSS technique.

    I have used that one before and I know it works with all browsers 4.0+

    (NN, IE and even Opera too)

    IE 3.0 is another issue though

  8. #8
    SitePoint Member
    Join Date
    Dec 2000
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have successfully used the css as outlined by cckrocks. It is accomplishing what I wanted it to. Thanks for all the input.

    Gary

    http://www.voxanova.com



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •