I put small images into a large image and use background-position
to set the position of the small image in the large one.
When #nav_left_home
is onhover
, the background image position is changed from 0 32px
to be 0 0
.
#nav_left_home {
background-position: 0 32px;
background-image: url('../img/nav_left.png');
transition: background-image 0.5s ease-in-out;
}
#nav_left_home:hover {
background-position: 0 0;
}
With the above code, the red house would move up when onhover
and the white house will appear under the red house and move up until replace the position.
But I only want to change the color of the image (no moving in position) as in the way color
changes with transition.