Ultrashock Forums > Development > Client Side
CSS - vertically aligning body background images

You are currently viewing our website as a guest which gives you limited access to forums, files and other resources.

Click here to join now for free, and start interacting with our members, download files and much more!

Click here if you are looking for our Flash files and other professional assets.
 
Post Reply | View first unread | Rate Thread Search this Thread | Thread Tools | Display Modes

#1
Bookmark and Share!
CSS - vertically aligning body background images
Old 2008-03-25

How can I vertically align a background image for the page body so that it will always appear in the middle and have equal space above and below the image? I tried using centre and 50% but it just moves the image to the top and then hides 50 half of it out of sight.
FredVaux.com | LightFused.net
postbit arrow 1 comment | 2150 views postbit arrow Reply: with Quote   
Registered User
flashkicks is offline
seperator
Posts: 667
2005-06-17
Age: 21
flashkicks lives in United Kingdom
seperator

Ultrashock Member Comments:
Nutrox's Avatar Nutrox Nutrox is online now Super Moderator Nutrox lives in United Kingdom 17 Creative Assets 2008-03-25 #2 Old  
Set the HTML height to 100% and add the background image to that.

Code:
html
{
    height:100%;
    background:#FFFFFF url( myimage.jpg ) no-repeat fixed center center;
}
That has always worked for me.
Reply With Quote  
Thread Tools
Display Modes Rate This Thread
Rate This Thread: