使用CSS Sprites和带有透明像素的repeat-x背景位置
我问的到底是什么标题……
#submenu-outer{
height:40px;
background: #F0EFE2 url(/template/img/main/intro12.png) 0px -240px repeat-x;
width:100%;
}
该代码毫无意义;有什么建议吗? 我想重复这一行的第一列。 每隔一行(40 像素)为空(0 像素 -240 像素)
I'm asking exactly what the title says...
#submenu-outer{
height:40px;
background: #F0EFE2 url(/template/img/main/intro12.png) 0px -240px repeat-x;
width:100%;
}
That code makes no sense; Any suggestions?
I want to repeat the first column of this line.
Every other line (of 40px) is null there (0px -240px)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用
repeat-x
作为背景位置,它将重复图像文件的整个宽度。因此,如果你的精灵中在 40 像素之后有透明像素,那么每隔 40 像素左右就会得到一些透明背景,这实际上是正常的。您可以使重复图案占据整个精灵宽度,或将其放入单独的文件中。
If you use
repeat-x
as background position it will repeat the whole width of the image file. So if you have transparent pixels in your sprite after 40px, it's actually normal that you get some transparent background every 40px or so.You could either make your repeating pattern take the whole sprite width, or put it in a seperate file.