为什么不能将我的精灵图像显示为黄色边框的背景? 这里有一个例子:不会显示雪碧图像?
如果有人能来与我应该改变什么一些例子,这将是伟大的..
只要让我发布媒体链接,需要在这个comapred到代码的文本发布-.-
这里是我的代码:
HTML:
<div class="repeat">
<div style='width:100%;'>
<div style='float:left;margin-top:107px;margin-left:50px;width:80px;height:100px;border:1px solid yellow;'>
<div class="menu">
<ul id='nav'>
<li class='front'><a href='?p=front'>Front</a></li>
</ul>
</div>
</div>
<div style='float:left;margin-top:107px;margin-left:10px;width:80px;height:100px;border:1px solid yellow;'></div>
<div style='clear:both;'></div>
</div>
</div>
个定制CSS:
.repeat {
float:left;
width: 884px;
height: auto;
min-height:700px;
background: url(images/repeat.png) repeat-y;
z-index:2;
}
.menu {
width:80px;
height:100px;
position:relative;
}
ul#nav {
list-style: none inside;
}
ul#nav li {
display: inline;
}
ul#nav li a {
display: block;
height: 40px;
float: left;
}
ul#nav li.front a{
width:80px;
background: url(images/menu/p1.png) top center no-repeat;
}
ul#nav li a:hover {
background-position: bottom center;
}
ul#nav li.front2 a{
width:80px;
background: url(images/menu/p1.png) bottom center no-repeat;
}
尝试把绝对的而不是相对的URL放在'background:url('images/menu/p1.png')...' – dnagirl
你是什么意思? o.O – Matthew
咦?黄色边框没有设置“背景图像”。 – Nix