Jump to content

Centering content on background image


GeemanKan

Recommended Posts

Hey guys, I was just wondering if anyone could help me to center content into the middle of a background image using css/html. An example of what I mean is TzarMag even when you zoom in/out the content of the site still stays centered to the background image and you never see the black gap in the middle part of the image which you can view HERE.

 

Hope I've made it clear enough for some of you coding gurus out there to help me.

Link to comment
Share on other sites

See...

http://www.w3schools.com/cssref/pr_background-position.asp

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><title>title</title><style>*{margin:0;padding:0;}body{background-image:url("http://www.tzarmag.com/uploads/2014/02/21/tzar-skin.jpg");background-position:center; }#wrap{width:965px;min-height:900px;margin:0 auto;background-color:#555;}</style></head><body><div id="wrap"></div></body></html>
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...