CSS 精灵帮助

发布于 2024-07-24 05:03:34 字数 300 浏览 6 评论 0原文

我最初使用以下代码:

background-image: url(../images/tabbottom.gif);
background-repeat: no-repeat;
background-position: left bottom;

问题是当我将其转换为精灵时,我有一个固定的背景位置,比如 0px -400px;

那么我该如何将它放在左下角呢?

另外,我可以将background-repeat与css sprite一起使用吗?

感谢您的时间。

I was originally using the following code:

background-image: url(../images/tabbottom.gif);
background-repeat: no-repeat;
background-position: left bottom;

The problem is when I convert it to a sprite, I have a fixed background-position, say 0px -400px;

Now how do I place it at the left bottom then?

Also, can I use background-repeat with a css sprite?

Thank you for your time.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

醉殇 2024-07-31 05:03:34

background-repeat 不会与你的 css sprite 很好地配合。 也不会将其设置为左下角。 不幸的是,解决这个问题的唯一方法是使用静态宽度和高度。 在这种情况下,你最好不要使用精灵

background-repeat will not play nicely with your css sprite. nor will setting it to bottom left. Unfortuantely the only way around this is to use static width and height. In this case, you're better off not using the sprite

原来分手还会想你 2024-07-31 05:03:34

现在我如何将它放在左边
那么到底?

通过了解元素的像素尺寸并仔细定位它

另外,我可以将background-repeat与css sprite一起使用吗?

当然 - 只要你只在一个方向上重复并且你的精灵排列成一行(而不是网格)。

Now how do I place it at the left
bottom then?

By knowing the pixel dimensions of the element and positioning it carefully

Also, can I use background-repeat with a css sprite?

Sure - so long as you only repeat in one direction and your sprites are arranged in a line (not a grid).

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