悬停时过渡色会褪色吗? [英] Transition color fade on hover?
本文介绍了悬停时过渡色会褪色吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使此h3
在悬停时褪色.有人可以帮我吗?
I am trying to get this h3
to fade on hover. Can someone help me out?
HTML
<h3 class="clicker">test</h3>
CSS
.clicker {
-moz-transition:color .2s ease-in;
-o-transition:color .2s ease-in;
-webkit-transition:color .2s ease-in;
background:#f5f5f5;padding:20px;
}
.clicker:hover{
background:#eee;
}
推荐答案
您要淡出什么? background
或color
属性?
What do you want to fade? The background
or color
attribute?
当前,您正在更改背景色,但要告诉它过渡color属性.您可以使用all
转换所有属性.
Currently you're changing the background color, but telling it to transition the color property. You can use all
to transition all properties.
.clicker {
-moz-transition: all .2s ease-in;
-o-transition: all .2s ease-in;
-webkit-transition: all .2s ease-in;
transition: all .2s ease-in;
background: #f5f5f5;
padding: 20px;
}
.clicker:hover {
background: #eee;
}
否则,只需使用transition: background .2s ease-in
.
这篇关于悬停时过渡色会褪色吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文