Powered by InterCreatives | Site Map
Search:
NewSourceMedia Popular Tutorials: PHP Javascripts Web Hosting
SoftwareTutorials
CATEGORIES
Job Listings
 
Home / CSS / Images

Css Center Background Image


Question: How do I center the backgournd image on my web page so then when I change the window size, the image stays center under the content?

Answer: Try using CSS (Cascading Style Sheets) to manage your background images. The key is the “background-position:top center;”. This will do the trick. See below for an example.

<style type="text/css">
<!--
body{ font-size:x-small;
background-color:FFFFFF;
background-image:url(bg.jpg);
background-attachment:fixed;
background-repeat:repeat-y;
background-position:top center;
margin-top: 610px;}
-->
</style>

Note: Make sure you change the above "bg.jpg" to your background image path.


Next CSS Page:
1  [2]  3 





Hosting by iPowerWeb.com - 50 Gb for $7.95