Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jun 2009
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Background images

    Really wasn't sure what to title this, or if this is a common question. Didn't see an answer in the FAQ, so I'm hoping it's not. It's 5am and I've been up all night trying to figure this out, so forgive me if I missed it.

    What I want to happen is the background texture to repeat, which is working. On top of that I want an image to always be centered no matter the browser size. I want it to follow what's in the wrapper basically. Now the way I have it set up is "huh" is a div around "wrapper". Everything is working except "huh" wont stay centered with "wrapper. "wrapper" stays in the center and moves with the browser size, but "huh" is stuck on the left.

    If this doesn't make sense I will host the website temporarily so you can see what's happening.
    Code:
    body {
    	background-image:url(img/backgroundtexture.jpg);
    	background-attachment:fixed;
    }
    
    #huh {
    	margin: 0px auto 0px;
    	background-image:url(img/background.png);
    	background-attachment: fixed;
    	background-repeat:no-repeat;
    }
    
    #wrapper {
    	height: 768px;
    	width: 700px;
    	background-color: white;
    	margin: 0px auto 0px;
    }

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Don't you need to set the background-position ?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    Simple_Echo (06-14-2009)

  • #3
    New to the CF scene
    Join Date
    Jun 2009
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Holy Crap! I never noticed that line of code before. This is honestly my first time attempting anything other then a repeating bg pattern, but I still feel like an idiot. Added background-position:center; to "huh" and it fixed it. Woot! Thanks a ton!


  •  

    Posting Permissions

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