For using mouse into one element we use the :hover
CSS attribute. How about for mouse out of the element?
I added a transition effect on the element to
You only need the :hover
, when you mouse out of the element, it'll return to it's default non-:hover state, like this:
.class { color: black; }
.class:hover { color: red; }
when you hover, the color will be red and when you "mouseout", the color will return to black because it no longer matches the :hover
selector. This is the default behavior for all browsers, nothing special you need to do here.