简体   繁体   English

使用CSS Sprites和repeat-x background-position与透明像素

[英]Using CSS Sprites and repeat-x background-position with transparent pixels

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) 每隔一行(40px)为空(0px -240px)

If you use repeat-x as background position it will repeat the whole width of the image file. 如果使用repeat-x作为背景位置,它将重复图像文件的整个宽度。 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. 因此,如果在40px之后你的精灵中有透明像素,那么每40px左右获得一些透明背景实际上是正常的。

You could either make your repeating pattern take the whole sprite width, or put it in a seperate file. 您可以使重复模式采用整个精灵宽度,也可以将其放在单独的文件中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM