[英]Input[type =“button”] sprite hover with transition problems
I would like to know, how you can add a transition when I hover my button. 我想知道,当我将鼠标悬停在按钮上时如何添加过渡效果。 I have made it as a sprite.
我已经把它当作精灵了。 with two separate images I can make the transition... Is there a good way to make this happen so I save a server request using a sprite.
使用两个单独的图像,我可以进行过渡...是否有实现此目标的好方法,所以我使用Sprite保存了服务器请求。
.udfyld_data input[type="button"] {
background:url(../../images/kurv/til-betaling-knap.png) no-repeat;
width:192px;
height:37px;
border:0;
cursor:pointer;
}
.udfyld_data input[type="button"]:hover {
background-position: 0 -37px;
display:block;
}
Add css3 transition
property 添加CSS3
transition
属性
transition: [duration] [property] [timing-function]
So your code will be like this: 因此,您的代码将如下所示:
.udfyld_data input[type="button"] {
.....
transition: 1s background linear;
/*For browser compatibility*/
-moz-transition: 1s background linear;
-webkit-transition: 1s background linear;
}
UPDATED 更新
Use div
instead of input
button 使用
div
代替input
按钮
HTML : <div class="button"><span></span></div>
HTML :
<div class="button"><span></span></div>
I added a span for some hack 我为一些骇客添加了跨度
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.