How to add hover transition effects

Learn how to add hover transition effects with CSS.

Hover transition

CSS transitions allow you to smoothly change attribute values over a given duration (from one value to another).

Add a transition effect (opacity and background color) to the button when the mouse hovers over it:

实例

Mouse over fade in:

亲自试一试

实例

鼠标悬停时背景淡出:

亲自试一试

相关页面

教程:CSS 过渡