如何使用精灵作为输入翻转?
有没有快速简便的方法来使用精灵在输入上创建翻转?
我不太熟悉输入,特别是您对输入的翻转所做的事情。我了解在标签上使用精灵。我还了解使用 Javascript onMouseOut 处理两个图像的概念,但我真的更喜欢使用精灵。它们似乎工作得最好,我不必担心闪烁。
这是我正在使用的图像:
这是我正在使用的代码:
<style>
#newsletterSubmit{background:url(/Images/Buttons/submit.png) 0 0 no-repeat;display:block;width:90px;height:50px;text-indent:-9000px;}
</style>
<input id="newsletterSubmit" type="image" src="Images/Buttons/Submit.png" onmouseover="document.getElementById('newsletterSubmit').style.backgroundPosition='0px -50px';" onmouseover="document.getElementById('newsletterSubmit').style.backgroundPosition='0px 0px';" />
Is there any quick and easy way to use a sprite to create a rollover on an input?
I am not that familiar with inputs and specifically what you do regarding rollovers on inputs. I understand using sprites on tags. I also get the concept of using Javascript onMouseOut with two images, but I would really prefer to use a sprite. They seem to work best and I won't have to worry about flickering.
Here is an image I am working with:
Here is the code I am working with:
<style>
#newsletterSubmit{background:url(/Images/Buttons/submit.png) 0 0 no-repeat;display:block;width:90px;height:50px;text-indent:-9000px;}
</style>
<input id="newsletterSubmit" type="image" src="Images/Buttons/Submit.png" onmouseover="document.getElementById('newsletterSubmit').style.backgroundPosition='0px -50px';" onmouseover="document.getElementById('newsletterSubmit').style.backgroundPosition='0px 0px';" />
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不需要 javascript 或
onmouseover
,这一切都可以通过 CSS 完成。这是一个简单的示例:演示: http://jsbin.com/ihafib
您需要检查坐标并适当裁剪它以确保一切都正确排列。
You don't need javascript or
onmouseover
, it can all be done with CSS. Here is a simple example:Demo: http://jsbin.com/ihafib
You'll want to check the coordinates of your sprite and crop it appropriately to make sure everything lines up correctly.