SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru
    Join Date
    Oct 1999
    Location
    New York, NY
    Posts
    826
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    aligning a bg image

    Hi --

    I finally figured out how to achieve a "fixed" background image and have it not repeat.

    <style type="text/css">
    <!--
    BODY {
    background-image:url(images/bgtable.gif);
    background-repeat:no-repeat;
    background-color:#FFFFFF;
    margin:0px;
    }
    -->
    </style>

    This code accomplished what I want but puts the image in the upper left hand coner of the page. Is there a code I can add to get the image more centered (more to the right, and more down...)??

    Also, on a "professional" level, is this style of web design "acceptable"??! (I'm refering to the fixed bg image...!)

    Thanks.

    Josh

  2. #2
    SitePoint Wizard Aes's Avatar
    Join Date
    Jun 2001
    Location
    Oklahoma
    Posts
    3,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've never heard of doing this; but with CSS who knows?



    How is it fixed though? In the above code I see nothing that would make the browser display the background as a "fixed" image.

    As for the proffesional element, I see nothing wrong with it as long as it works with the design. I've seen some nifty background images that are light grey (on a white background so you can barely make it out), and it's fixed in the center. It looked very good!

    But other colors would work as well I'm sure.
    Colin Anderson
    Ambition is a poor excuse for those without
    sense enough to be lazy.

  3. #3
    pg for mild peril cow's Avatar
    Join Date
    Mar 2000
    Location
    nevada, usa
    Posts
    636
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: aligning a bg image

    Originally posted by JCary

    This code accomplished what I want but puts the image in the upper left hand coner of the page. Is there a code I can add to get the image more centered (more to the right, and more down...)??

    Also, on a "professional" level, is this style of web design "acceptable"??! (I'm refering to the fixed bg image...!)
    add background-position:bottom right; to the body properties. you can also use px or %...

    i've seen plenty of fixed bg images. the main problem i have with them is that some people use very complicated images that make it difficult to read the text as it passes over the bg image... also the scrolling isn't smooth if the image size is too large. but i've seen plenty of well-done bg images...
    "There's no justice like angry mob justice!" --Seymour Skinner

  4. #4
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    According to w3 the following are valid for background-position

    top,center,bottom,left,right

    with the default being top,left.

    background-attachment:fixed/scroll;

    should also be used.
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky


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
  •