使用CSS Sprites和带有透明像素的repeat-x背景位置

发布于 2024-12-17 10:47:24 字数 242 浏览 3 评论 0原文

我问的到底是什么标题……

#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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

抱着落日 2024-12-24 10:47:26

如果您使用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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文