Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Transition color fade on hover?

Tags:

css

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; } 
like image 762
J82 Avatar asked Jan 16 '13 01:01

J82


People also ask

How do you do a transition on hover?

CSS transitions allows you to change property values smoothly (from one value to another), over a given duration.

Does transition work only on hover?

This will animate the color property when you hover over a link on the page. Pretty simple, and you've probably seen or used something similar. But transitions are not just limited to use with :hover . You can animate CSS properties, thus use CSS transitions without hover.

How do you change the color of button on hovering?

To change the color/size of the button in hover state. Approach: Set the animation and time duration of hover state. Set background color using @keyframes.


1 Answers

What do you want to fade? The background or color attribute?

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; } 

Otherwise just use transition: background .2s ease-in.

like image 74
Austin Brunkhorst Avatar answered Sep 16 '22 16:09

Austin Brunkhorst