Help - Search - Members - Calendar
Full Version: Problem With Background Image
HTMLHelp Forums > Web Authoring > General Web Design
xNikix
I was wondering if anyone could tell me how to align my background image with the rest of the layout, I've tried everything I can think of and nothing is working. The image I want centered can be found here. If you save the code in notepad or something and open it in a browser you'll see what I mean by it not aligning with everything else. I figure that my problem is somewhere in the first line of code below the style beginning. If you preview the layout it works best in Firefox. Please help me! I can't figure out what I did wrong.

CODE
<html>
<head>
<title>Hello Treats</title>
</head>

<style type="text/css">
body { background: #662706 url("http://cyanidesplash.netii.net/hellotback.png") repeat-y;}
td, p, body, a { color: #f955ab; font-family: arial; font-size: 12px;}
a:visited, a:link { color: #f60758; font-family: arial; font-size: 12px; font-weight: bold; text-decoration: none;}
a:active, a:hover { color: #662706; font-family: arial; font-size: 12px; font-weight: normal; text-decoration: none;}
CONTENT, .SIDEBAR{ font-family: arial; font-variant: small-caps; color: #f60758; background: #662706;
border-bottom: 1px dotted #f955ab; border-top: 1px dotted #f955ab; border-right: 1px dotted #f955ab; border-left: 1px dotted #f955ab; font-size: 14pt; line-height: 16px; letter-spacing : 2px; text-align: center;}
b { color: #662706;}
u { color: #662706; border-bottom: 1px dotted #f60758; text-decoration: none;}
i { color: #f955ab;}
s { background: #662706;}
textarea, input { width : 100px; height:}
blockquote { width: 300px; text-align: justify; background: #fab4ce; border-left: 1px dotted #f955ab; border-right: 1px dotted #f955ab; border-top: 1px dotted #f955ab; border-bottom: 1px dotted #f955ab;
margin-top: 3px; margin-bottom: 3px; padding: 2px;}
#header {position:absolute; left:200px; top: 0px;}
#sidebar {position:absolute; top:390px; left:615px; width:180px;}
#content {position:absolute; top:390px; left:205px; width:370px;}
</style>

<body>

<!--- Header --->
<div id="header">
<img src="http://cyanidesplash.netii.net/hellottop.png" width="600" height="519" border="0">
</div>
<!--- End Header --->

<!--- Content --->
<div id="content">
<div class="sidebar">Hello Treats Layout</div><br>  
I made this layout out of sheer boredom. The images used in the layout design are from <a href="http://www.hellokitty.fr/blog/index.php/2008/10/01/1007-hello-kitty-selection-we-love-cute">HelloKitty.Fr</a>. To get this layout you can either download the .zip or you can copy the layout code, both methods can be found under the screen cap of this layout on the <a href="http://cyanidesplash.netii.net/layouts.html">layouts</a> page. Please don't remove my credits, I work hard on all of my layouts.<br>
<br>
<div class="sidebar">BIUS</div><br>
<blockquote><b>Bold</b>, <i>Itallics</i>, <u>Underline</u>, <strike>Strikethrough</strike></blockquote>
<br><br>
</div>
<!--- Content --->

<!--- Start Sidebar --->
<div id="sidebar">
<div class="sidebar">About</div>
<b>Name:</b> Your Name<br>
<b>Age:</b> Your Age<br>
<b>Likes:</b> Your Likes<br>
<b>Dislikes:</b> Your Dislikes
<br><br>

<div class="sidebar">Navigation</div>
<a href="http://yourlink.com/">Link</a><br>
<a href="http://yourlink.com/">Link</a><br>
<a href="http://yourlink.com/">Link</a><br>
<a href="http://yourlink.com/">Link</a><br>
<a href="http://yourlink.com/">Link</a>
<br><br>

<div class="sidebar">Layout Credit</div>
Design/Coding: <a href="http://cyanidesplash.netii.net">Cyanide Splash</a>
</div>
<!--- End Sidebar --->

</body>
</html>
pandy
URL to the page please?
pandy
OK, it works anyway. To center the background, add 'center' to the mix, or maybe 'top center' is better.

CODE
body { background: #662706 url("http://cyanidesplash.netii.net/hellotback.png") repeat-y top center;}


http://www.w3.org/TR/CSS2/colors.html#propdef-background
http://www.w3.org/TR/CSS2/colors.html#prop...ground-position
xNikix
Ohhhh okay! I feel so dumb now I can't believe I missed adding that, thanks so much smile.gif
pandy
No problem. I'm dumb at least once a day myself. happy.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.