was trying to update my horizontal nav menu with a background image. i
tried everything and couldn't get it to work.
while searching for solutions, i came across this tutorial:
http://www.webcredible.co.uk/user-friendly-resources/css/css-navigation-menu.shtml
i thought it was pretty nice, so i tried the code exactly as they had
it listed.
everything worked great... except the background give didn't show up
so my box background is plain old vanilla white.
UUUUGGGGH!
does anybody have a clue why my background isn't showing up in either
firefox 1.0 or ie 6.0? i saved the gif and put it into mymain folder.
tia...
-------------------------------------------
here's the html i'm using:
<div id="nav-menu">
<ul>
<li><a href="#">Services</a></li>
<li><a href="#">About us</a></li>
<li><a href="#">Contact us</a></li>
</ul>
</div>
here's the css:
#nav-menu ul
{
list-style: none;
padding: 0;
margin: 0;
}
#nav-menu li
{
float: left;
margin: 0 0.15em;
padding: 0;
text-align: center
}
#nav-menu li a
{
background: url(hmenu.gif) #fff bottom left repeat-x;
height: 2em;
line-height: 2em;
float: left;
width: 9em;
display: block;
border: 0.1em solid #dcdce9;
color: #0d2474;
text-decoration: none;
text-align: center;
}
/* Commented backslash hack hides rule from IE5-Mac \*/
#nav-menu li a
{
float: none
}
/* End IE5-Mac hack */
#nav-menu
{
width:30em
}
> was trying to update my horizontal nav menu with a background image. i
> tried everything and couldn't get it to work.
[quoted text clipped - 17 lines]
>
> -------------------------------------------
<snip>
> #nav-menu li a
> {
[quoted text clipped - 9 lines]
> text-align: center;
> }
<snip>
Without seeing your page, I am thinking this could help.
Try changing this line
background: url(hmenu.gif) #fff bottom left repeat-x;
to:
background-image: url(hmenu.gif) bottom left repeat-x;
background: #fff;
That should be far more reliable.
Neal - 25 Dec 2004 06:29 GMT
> Try changing this line
>
[quoted text clipped - 3 lines]
>
> background-image: url(hmenu.gif) bottom left repeat-x;
background-image has 3 possible values: <uri> | none | inherit . The other
stuff can't go here. It can go in background. But unless I'm screwed up,
using the generic background property resets everything to default and
then changes as you've directed. So
> background: #fff;
would undo everything you just set.
See <http://www.w3.org/TR/CSS21/colors.html> for a full discussion of the
background properties.
Skeets - 25 Dec 2004 06:40 GMT
when i use "red" instead of the link to the image, it works and
displays a red background. it also worked in my original nav bar.
when i use a link, to a gif, though, it doesn't work.
Skeets - 25 Dec 2004 06:31 GMT
saz, thanks. i made the update and it didn't help.
i have actually set up an html page that imports a css page.
the html page contains the html in my first post and the css page
contains the listed css code. i wanted everything as simple as
possible to work through this issue.
everything works dandy - except the darn background doesn't display.
of course, it does in the tutorial - just not my application of it.
my bad. my css file is in a common subdirectory. i have to move up a
directory to get into my images directory.
i haven't verified it - but i know that's my problem.
thanks for the help and happy holiday!