css sprite navigation

2019-07-27 06:22发布

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?

4条回答
做个烂人
2楼-- · 2019-07-27 06:36

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.

查看更多
聊天终结者
4楼-- · 2019-07-27 06:56

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

查看更多
Viruses.
5楼-- · 2019-07-27 06:58
登录 后发表回答