Full page background on site

Discussion in 'HTML & Website Design' started by fadetoblack22, Jul 16, 2011.

  1. #1
    I'm using the following to get a full page background image on my site:

    img.bg {
            /* Set rules to fill background */
            min-height: 100%;
            min-width: 1024px;
    
            /* Set up proportionate scaling */
            width: 100%;
            height: auto;
    
            /* Set up positioning */
            position: fixed;
            top: 0;
            left: 0;
    }
    
    @media screen and (max-width: 1024px) { /* Specific to this particular image */
            img.bg {
                    left: 50%;
                    margin-left: -512px;   /* 50% */
            }
    }
    HTML:
    	<img src="images/bg.jpg" class="bg">
    HTML:
    Used from this site: http://css-tricks.com/3458-perfect-full-page-background-image/


    However because it is using an image instead of a background image, it pushes all my content out of the way. I have used position = relative in some of my divs and it seems to be working. I'm just wondering that if I have used that in my wrap div, will everything else inside be ok?

    thanks.
     
    fadetoblack22, Jul 16, 2011 IP
  2. hostrea

    hostrea Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    IMO you should set the background to the body if you want it to be full screen. You can do it through the CSS.

    
    body {
       background: url(path/to/image) no-repeat;
    }
    
    
    HTML:
    This is very common on the web.
     
    hostrea, Jul 16, 2011 IP
  3. fadetoblack22

    fadetoblack22 Well-Known Member

    Messages:
    2,399
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    160
    #3
    Like that though it doesn't stay fixed while the page content rolls over the top of it like in the example.
     
    fadetoblack22, Jul 17, 2011 IP
  4. r4fay

    r4fay Guest

    Messages:
    101
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
  5. fadetoblack22

    fadetoblack22 Well-Known Member

    Messages:
    2,399
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    160
    #5
    fadetoblack22, Jul 17, 2011 IP
  6. casreeve

    casreeve Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    what CMS are you using?
     
    casreeve, Jul 17, 2011 IP
  7. fadetoblack22

    fadetoblack22 Well-Known Member

    Messages:
    2,399
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    160
    #7
    Using Wordpress
     
    fadetoblack22, Jul 18, 2011 IP
  8. casreeve

    casreeve Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    PM with your IM Details, i have a few tricks i have been trying myself for just this kind of thing... not all of them work perfectly but i have found that using one or the other has got me through... :) i tried that link myself but it never quite looks right...
     
    casreeve, Jul 18, 2011 IP
  9. fadetoblack22

    fadetoblack22 Well-Known Member

    Messages:
    2,399
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    160
    #9
    I worked out what to do. I used z-index on the background image css and it is fine now.
     
    fadetoblack22, Jul 18, 2011 IP