[英]Css hover button effect
look at this fiddle JS FIDDLE When i hover( :hover
) background
changes but when clicked ( :active
) box-shadow
is not changed dont know why ? 看着这个小提琴JS FIDDLE当我的hover( :hover
) background
发生变化但单击( :active
) box-shadow
不变时,不知道为什么吗? This does not happen if another button does not change background
on hover ! 如果另一个按钮没有更改悬停background
,则不会发生这种情况!
in this fiddle i want somehthing like combination of button 1
and button 2
在这个小提琴中,我想要类似button 1
和button 2
组合
.white-button {
background: #FFF;
font-weight: normal;
color: #3b3b3b;
border: 1px solid #DDD;
box-shadow: 0 0 2px #ccc;
font-family: MV boli,Tahoma;
margin: 5px;
padding: 5px 10px 5px 10px;
font-size: 15px;
}
.positive:enabled:hover {
background: #99CD30;
box-shadow: inset 2px -7px 11px rgba(80, 92, 51, 0.17)!important;
}
button:active {
border-bottom-color: #999;
box-shadow: inset 0 3px 3px rgba(0, 0, 0, .2);
}
.gray-button{
background:#eee;
padding:5px 10px;
border: 1px solid #999;
border-bottom-color: #888;
}
For those who cant under stand! 对于那些谁不能站!
As you see there are 3 buttons on fiddle with name like
lets say then button A,B and C
respectively. 如您所见,小提琴上有3个按钮,它们的名字分别like
按钮A,B and C
A
i get a green background with an inset box-shadow . 现在,当我将鼠标悬停在A
我得到一个绿色的背景,带有一个嵌入式的盒子阴影 。 B
i get a green background with no inset shadow 当我将鼠标悬停在B
我会看到绿色的背景,没有任何阴影 When i hover C
i get nothing 当我悬停C
我什么也没得到
When i click A
it remains same 当我单击A
它保持不变
B
an inset shadow is created 当我单击B
,会创建插图阴影 C
an an inset shadow is created 当我单击C
,将创建一个嵌入阴影 Now the button i want is D
i want 现在我想要的按钮是D
我想要
D
i get ai get a green background with an inset 当我将鼠标悬停在D
我会得到带有插图的绿色背景 when i click D
an another inset shadow is created replacing previous one. 当我单击D
将创建另一个插图阴影来替换先前的阴影 。
but that does not happen dont know why ? 但这不会发生,不知道为什么吗?
I hope this is how you want it.. 我希望这就是你想要的。
http://jsfiddle.net/rahulrulez/M2f9F/3/ http://jsfiddle.net/rahulrulez/M2f9F/3/
I just played with properties that are !important
我只是玩过!important
属性
.white-button {
background: #FFF;
font-weight: normal;
color: #3b3b3b;
border: 1px solid #DDD;
box-shadow: 0 0 2px #ccc;
font-family: MV boli,Tahoma;
margin: 5px;
padding: 5px 10px 5px 10px;
font-size: 15px;
}
.positive4:hover {
background: #99CD30;
box-shadow: inset 2px -7px 11px rgba(80, 92, 51, 0.17);
}
.positive4:active {
border-bottom-color: #999;
box-shadow: inset 0 3px 3px rgba(0, 0, 0, .2) !important;
}
I hope this answers your question 我希望这回答了你的问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.