使用CSS在单击按钮时更改图像精灵
单击更改按钮图像,然后单击后返回原始图像使用CSS在单击按钮时更改图像精灵,css,button,onclick,sprite,Css,Button,Onclick,Sprite,单击更改按钮图像,然后单击后返回原始图像 <style> img.button-send { background: url(img/agentsprite.png) 0 0; width:87px; height:34px; opacity:0; } img.button-send:active { background: url(img/agentsprite.png) 34 174; width:87px; height:34px; } </style>
<style>
img.button-send {
background: url(img/agentsprite.png) 0 0;
width:87px;
height:34px;
opacity:0;
}
img.button-send:active {
background: url(img/agentsprite.png) 34 174;
width:87px;
height:34px;
}
</style>
<button type="submit">
<img class="button-send" src="img/img_trans.gif" width="1" height="1" />
</button>
按钮发送{
背景:url(img/agentsprite.png)0;
宽度:87px;
高度:34px;
不透明度:0;
}
img.按钮发送:激活{
背景:url(img/agentsprite.png)34174;
宽度:87px;
高度:34px;
}
我用了一个精灵来做这个,当我点击它的时候,它似乎不会转到那个图像的位置,有什么方法可以让它工作吗?按下时,我不希望此字段有按钮效果。 hi现在用于px值在您的
背景位置
图像中
像这样
img.button-send:active {
background: url(img/agentsprite.png) 34px 174px;
}
或者你也可以用这个
img.button-send:active {
background-position:34px 174px;
}
根据您的设计
px
值
hi现在用于px值在您的背景位置
图像中
像这样
img.button-send:active {
background: url(img/agentsprite.png) 34px 174px;
}
或者你也可以用这个
img.button-send:active {
background-position:34px 174px;
}
px
值根据你的设计哦,这就是我错过的“它现在可以工作了,我必须等待10分钟才能接受你的ANSO,这就是我错过的”它现在可以工作了,我必须等待10分钟才能接受你的ans