CSS精灵导航

发布于 2024-09-05 21:04:33 字数 222 浏览 2 评论 0原文

是否可以在 CSS 精灵导航中使用三个图像?

这可能是这样的

我的图片 http://img710.imageshack.us/img710/1429 /navigx.jpg

如果可能的话结果会怎样?

Is it possible to use three images in CSS sprite navigation?

This may be like this

My image http://img710.imageshack.us/img710/1429/navigx.jpg

If its possible what will be the result?

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

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

发布评论

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

评论(4

梦萦几度 2024-09-12 21:04:33

您可以在精灵中使用任意数量的图像,只需在 CSS 中移动位置即可:

.sprite1
{
background-image:url(../../upload/btn_continue_sprite.png);
    background-repeat:no-repeat;
    background-position: -10px 5px;
}

.sprite1:hover
{
background-image:url(../../upload/btn_continue_sprite.png);
    background-repeat:no-repeat;
    background-position: -20px 10px;
}

.sprite2
{
background-image:url(../../upload/btn_continue_sprite.png);
    background-repeat:no-repeat;
    background-position: -30px 15px;
}

.sprite2:hover
{
background-image:url(../../upload/btn_continue_sprite.png);
    background-repeat:no-repeat;
    background-position: -40px 20px;
}

只需计算出 px 距离以将精灵与元素正确对齐即可!

希望有帮助。

You can use any amount of images in a sprite, just move the positioning around in your CSS:

.sprite1
{
background-image:url(../../upload/btn_continue_sprite.png);
    background-repeat:no-repeat;
    background-position: -10px 5px;
}

.sprite1:hover
{
background-image:url(../../upload/btn_continue_sprite.png);
    background-repeat:no-repeat;
    background-position: -20px 10px;
}

.sprite2
{
background-image:url(../../upload/btn_continue_sprite.png);
    background-repeat:no-repeat;
    background-position: -30px 15px;
}

.sprite2:hover
{
background-image:url(../../upload/btn_continue_sprite.png);
    background-repeat:no-repeat;
    background-position: -40px 20px;
}

Just have to figure out the px distances to align the sprite to the element properly and you're away!

Hope that helps.

看轻我的陪伴 2024-09-12 21:04:33

您可以在精灵中使用任意数量的图像。取决于您的要求。

You can use any number of images in a sprite. Depends on your requirement.

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