dcsimg
www.webdeveloper.com
Results 1 to 4 of 4

Thread: [RESOLVED] Background image fixed width

  1. #1
    Join Date
    Feb 2009
    Location
    London, UK
    Posts
    37

    resolved [RESOLVED] Background image fixed width

    Hi Everyone. I'm new here, so if I seem like a moron, I probably am

    I have a question about fixing the width on my background image. I searched the threads, but didn't find exactly what I was looking for.

    You can see the problem here: http://www.webitseo.com
    I want the header image to only be as wide as the content area, instead of stretching across the whole screen. Here is my css:

    body {
    font: 85% "Trebuchet MS", Arial, Helvetica, sans-serif;
    font-size: 14px;
    background-image: url(images/bbg.jpg);
    background-repeat: repeat-x;
    }

    Any suggestions?

    Thanks,
    Annie

  2. #2
    Join Date
    Feb 2009
    Location
    London, UK
    Posts
    37
    Can anyone help with this? I want the image to repeat-x, but only to the width of the content. I tried setting the width in the body element, but that didn't help, infact it made things worse because it moved all the content to the left of the screen. Is there a way to fix the width of the repeat of an image?

  3. #3
    Join Date
    Feb 2009
    Posts
    1
    Your problem is that you are setting the background image in the BODY tag.

    What you want to do is set up a DIV that is the same width as your content area and the same hight as the green line. Inside that DIV will go the green portion of your background (so you'll have to cut that part out of the current background image). Then you just set that as the background of the DIV.

    But if you want my opinion, I say leave it the way it is. I think it looks better spanning across the whole screen.

  4. #4
    Join Date
    Feb 2009
    Location
    London, UK
    Posts
    37

    Smile

    Thank you very much for your help, Swasstastic! I will try it. And thanks for the comment. Maybe I'll just leave the green bar the way it is. But it's good to know how to sort these problems out. I love CSS, but it can be a bugger sometimes.
    Last edited by Webitseo; 02-24-2009 at 09:28 AM. Reason: Wanted to clarify who this was in response to

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles