Background HTML not fixed.

Discussion in 'HTML & Website Design' started by daverosen, Jan 22, 2011.

  1. #1
    I'm making a splash video page.
    I have a page, with a background picture of basically an outdoor cinema with a screen in the middle of the page.

    The problem is that the picture is 1440x788, and it has scroll bars because the pictures to big. What I would like to happen is for it to cut off (horizontally and vertically) the background so it will look correct.

    One site I saw that done this is CustomCoD . com.

    How do I do it like theres?
     
    daverosen, Jan 22, 2011 IP
  2. jeremyhowell

    jeremyhowell Member

    Messages:
    379
    Likes Received:
    7
    Best Answers:
    2
    Trophy Points:
    45
    #2
    I have always thought that a background image on a page doesnt make scroll bars if it is too big? Are you using the right CSS?

    
    body {
    background-image:url(image.jpg);
    }
    
    Code (markup):
     
    jeremyhowell, Jan 23, 2011 IP
  3. tomelliott

    tomelliott Peon

    Messages:
    38
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yes, make sure the background is part of the body tag and not a container DIV.
     
    tomelliott, Jan 23, 2011 IP
  4. CSM

    CSM Active Member

    Messages:
    1,047
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    55
    #4
    overflow:hidden could solve this problem, too...

    There is no need to use a background in body.
     
    CSM, Jan 23, 2011 IP
  5. Dodger

    Dodger Peon

    Messages:
    1,494
    Likes Received:
    60
    Best Answers:
    0
    Trophy Points:
    0
    #5
    You can always make the image dimensions smaller. If it is too large and with overflow hidden, it is going to get clipped.

    A couple of years ago we designed for 800px wide screens. Today it is 1024px, and thus the 960 grid. Your image is too large and you are omitting a lot of traffic from your overall image. Make it smaller and adapt.
     
    Dodger, Jan 23, 2011 IP
  6. daverosen

    daverosen Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I'm using this code exactly.

    <div style="background-image:url(images/splash-bg-test.jpg);
    	background-attachment:fixed;
    		min-height:100%;
    width:100%;
    position:absolute;
    overflow:hidden;">
    	</div>
    Code (markup):
    Change it around to something that would work if you have an idea of what I can do.
     
    daverosen, Jan 23, 2011 IP
  7. jeremyhowell

    jeremyhowell Member

    Messages:
    379
    Likes Received:
    7
    Best Answers:
    2
    Trophy Points:
    45
    #7
    Is this supposed to display as the background image of the whole page, or a single div? I dont see why you dont just add a background image to the body property in this case?
     
    jeremyhowell, Jan 23, 2011 IP
  8. Dodger

    Dodger Peon

    Messages:
    1,494
    Likes Received:
    60
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Plus it is kind of hard to advise, when we do not see the Html that comes before and after. It looks like that DIV is going to take up the whole screen and push everything else out of the way.
     
    Dodger, Jan 23, 2011 IP
  9. daverosen

    daverosen Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    I just googled "HTML Background" and used the first code I saw.

    If I can use something else, please give me the full code, and I'll try it out.
     
    daverosen, Jan 23, 2011 IP
  10. jeremyhowell

    jeremyhowell Member

    Messages:
    379
    Likes Received:
    7
    Best Answers:
    2
    Trophy Points:
    45
    #10
    
    body {
    background:url(images/splash-bg-test.jpg) fixed;
    }
    
    Code (markup):
     
    jeremyhowell, Jan 23, 2011 IP
  11. Dodger

    Dodger Peon

    Messages:
    1,494
    Likes Received:
    60
    Best Answers:
    0
    Trophy Points:
    0
    #11
    You have more patience than I do Jeremy.
     
    Dodger, Jan 23, 2011 IP
  12. daverosen

    daverosen Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    body {
    background:url(images/splash-bg-test.jpg) fixed;
    }
    Code (markup):
    Putting that in an HTML page just prints it.
    Can you convert that to code that will be fine in an HTML page?
     
    daverosen, Jan 23, 2011 IP
  13. jeremyhowell

    jeremyhowell Member

    Messages:
    379
    Likes Received:
    7
    Best Answers:
    2
    Trophy Points:
    45
    #13
    That is CSS not HTML. Put that in an external stylesheet or enclose it in <style></style> tags. Just curious do you have any experience in HTML coding at all?
     
    jeremyhowell, Jan 23, 2011 IP
  14. daverosen

    daverosen Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #14
    Perfect!
    Also, no comment.
     
    daverosen, Jan 23, 2011 IP