Okay so I’ve been frustrated with this for a couple hours now and if anyone can give me some help then it would be greatly appreciated. So, I’m trying to build this site and I’m working on the background image for the navigation. I want this image to span the whole width of the screen and contain the navigation all on one line. My thought was to set the image as the background for the div that contains the ul, set the width to 100% since the divs container (the body) fills 100% of the page, set the height to the minimum height of the background image (59px) and have it repeat in the x axis. Well, iv’e tried lots of things and you can see the last result that I got at this url. The funny thing is that I was able to get the cloud background image to work fine, but obviously i’m dealing with a list here which complicates things.
Thanks for any help you can provide. Also, I’d much rather have someone tell me my error in the code rather than just copying and pasting code that works.
It’s really not clear what you want here. Can you give some idea of how you want your design to look? At the moment, the cloud image is a background on the header … which doesn’t sound like what you have described here.
I was just saying that I got the background image to.work for the header, but I can’t get it to work for the nav. I want to make the gray bar the background for the navigation.
You have a div around your menu <ul>, which isn’t necessary. So the idea is to remove that div and put the #nav id (or a class) on the <ul> itself. E.g.
Instead of
<div id="nav">
<ul>
...
</ul>
</div>
you can just do
<ul id="nav">
...
</ul>
use this CSS: #nav li { float:left;} #nav {overflow:hidden; padding:0; margin:0 15%;}
You don’t need to remove that div, though. It’s just a little more efficient to do that.
Make that change, if you wish, and then we’ll go through step 2.
Edit:
Actually, looking at your image again, I’d suggest you keep the div after all. That way it will be a little easiet to have the gray band across the page. So, set up your style like so:
#nav {
overflow:hidden;
padding:0;
background-image:url(images/Main%20Nav%20background.jpg);
}
#nav ul {
list-style: none;
margin-top:0px;
margin-left:0px;
padding-left:0px;
width:1027px;
height:59px;
margin: 0 auto;
}
#nav ul li {
text-align: center;
line-height:59px;
white-space:nowrap;
color:#003;
float: left;
}
#nav ul li a{
display: block;
font-family:Georgia, "Times New Roman", Times, serif;
font-size:18px;
font-weight:bold;
background-image:url(images/Main%20Nav%20background.jpg);
min-height:100%;
min-width:100%;
padding: 0px 28px;
border-right: 1px solid black;
}
#nav ul li a:link, #nav ul li a:visited {
color:#000033;
text-decoration: none;
font-family:Arial, Helvetica, sans-serif;
}
#nav ul li a:hover, #nav ul li a:active {
color: #1860a3;
text-decoration: none;
}