GavinPearce
06-04-2007, 03:41 PM
I have a strange problem with CSS backgrounds. I have an image thats 750px wide, and am using css to place a 750px wide background image that repeats on the Y right down the page.
Therefore putting a white box behind a image that sits top center.
Here's the page: http://gavinpearce.co.uk/sailing/index.htm
However the background center and text-align center seem to be in two different places, if you look you'll notice that the image is one more pixel to left and the white is one more pixel to the right. so not right in the center, it does the same if the image size is changed to 749 pixels instead of 750px also ??? How can i get them to both align and why are they not?
Second problem is any idea how to get rid of the white space between the header image and the menu bar below? I want them to run smooth together but I cant for the life of me figure out how - ive minus padding and minus borders and everything !
The HTML is:
<html>
<head>
<title>WORK IN PROGRESS</title>
<link rel="stylesheet" media="all" type="text/css" href="style.css" />
</head>
<body>
<img src="header.jpg" alt="Welcome to Silverwing Sailing Club" />
<div id="menu1">
<ul>
<li><a href="#nogo">Home</a></li>
<li><a href="#nogo">About Us</a></li>
<li><a href="#nogo">Club Boats</a></li>
<li><a href="#nogo">Training</a></li>
<li><a href="#nogo">Youth</a></li>
<li><a href="#nogo">Contact</a></li>
<li><a href="#nogo">Location</a></li>
</ul>
</div>
</body>
</html>
and the CSS is:
body {
background: #000033 url(bg.gif) repeat-y 50%;
font: 80% arial, verdana, helvetica, sans-serif;
text-align: center;
min-width: 750px;
}
#container {
position: relative;
width: 749px;
margin: auto;
text-align: center;
}
#header {background: #f00; border:0; margin: 0; padding: 0;}
img { background: #f00; border:0; margin: 0; padding: 0;}
#menu1 {
width:750px;
padding:0;
margin:0 auto;
border: 0;
background:#08c url(menu_bg.jpg);
}
#menu1 li {
float:left;
width:85px;
list-style-type:none;
border:0px solid #fff;
}
#menu1 a {
display:block;
width:85px;
color:#fff;
float: left;
clear: left;
text-align:center;
padding:5px 0;
text-decoration:none;
float:left;
}
#menu1 li>a { float: none; }
#menu1 a:hover {
color:#fff;
background:#08c;
}
Anyway many thanks for even reading this far!!
Will try and take you out sailing at some point! :D
Therefore putting a white box behind a image that sits top center.
Here's the page: http://gavinpearce.co.uk/sailing/index.htm
However the background center and text-align center seem to be in two different places, if you look you'll notice that the image is one more pixel to left and the white is one more pixel to the right. so not right in the center, it does the same if the image size is changed to 749 pixels instead of 750px also ??? How can i get them to both align and why are they not?
Second problem is any idea how to get rid of the white space between the header image and the menu bar below? I want them to run smooth together but I cant for the life of me figure out how - ive minus padding and minus borders and everything !
The HTML is:
<html>
<head>
<title>WORK IN PROGRESS</title>
<link rel="stylesheet" media="all" type="text/css" href="style.css" />
</head>
<body>
<img src="header.jpg" alt="Welcome to Silverwing Sailing Club" />
<div id="menu1">
<ul>
<li><a href="#nogo">Home</a></li>
<li><a href="#nogo">About Us</a></li>
<li><a href="#nogo">Club Boats</a></li>
<li><a href="#nogo">Training</a></li>
<li><a href="#nogo">Youth</a></li>
<li><a href="#nogo">Contact</a></li>
<li><a href="#nogo">Location</a></li>
</ul>
</div>
</body>
</html>
and the CSS is:
body {
background: #000033 url(bg.gif) repeat-y 50%;
font: 80% arial, verdana, helvetica, sans-serif;
text-align: center;
min-width: 750px;
}
#container {
position: relative;
width: 749px;
margin: auto;
text-align: center;
}
#header {background: #f00; border:0; margin: 0; padding: 0;}
img { background: #f00; border:0; margin: 0; padding: 0;}
#menu1 {
width:750px;
padding:0;
margin:0 auto;
border: 0;
background:#08c url(menu_bg.jpg);
}
#menu1 li {
float:left;
width:85px;
list-style-type:none;
border:0px solid #fff;
}
#menu1 a {
display:block;
width:85px;
color:#fff;
float: left;
clear: left;
text-align:center;
padding:5px 0;
text-decoration:none;
float:left;
}
#menu1 li>a { float: none; }
#menu1 a:hover {
color:#fff;
background:#08c;
}
Anyway many thanks for even reading this far!!
Will try and take you out sailing at some point! :D