For some reason when I try to set a UL
background the background doesn't work. 开发者_如何学JAVAIt works on my body background but it isn't working for the UL
.
I know my image is named correctly. I have quadruple checked that. Here is my code:
HTML
<html>
<head>
<title>Header</title>
<link rel="stylesheet" type="text/css" href="css/Style.css" />
</head>
<body>
<div id="page-wrap">
<ul id="nav">
<li><a href="#">Link1</a></li>
</ul>
<p>Main</p>
</div>
</body>
</html>
CSS
body
{
background-image: url('../Images/body-background.jpg');
}
#page-wrap
{
width:1040px;
margin: 0 auto;
}
ul#nav
{
margin: 0 auto;
width: 1040px; height: 185px;
background-image: url('../Images/header-logo.jpg');
background-repeat: no-repeat;
}
From what it seems the UL
itself isn't working with the <a>
tag. Without it the "Link1" shows up. With it though nothing shows up. Either way the background isn't displaying.
Thanks!
http://jsfiddle.net/Z7MzE/2/
Looks like it's working to me.
Quintuple check that image for me.
I found a solution. Note that in my case, even placing a background image on a wrapper element was being hidden by the ul
for some inexplicable reason.
SOLUTION:
ul{}
ul{background:url('image.jpg');}
Don't ask me why it works, but it does. And it works for ANY element you have this problem with, because it cropped up a few times for me.
精彩评论