我试图将正常的背景颜色从正常颜色变为悬停颜色,但不幸的是,我所阅读和尝试的所有内容都无法正常工作.这是我的代码: .button-submit { color: #ffffff; cursor: pointer; display: inline-block; line
.button-submit { color: #ffffff; cursor: pointer; display: inline-block; line-height: 35px; background: #5ea12b; padding: 0px 20px; vertical-align: middle; font-size: 18px; min-width: 80px; min-height: 35px; font-family: Light; border: 1px solid transparent; margin: 5px; } .button-submit:hover { background: #5ea12b; color: #FFFFFF; }使用过渡属性:
例如:
.button-submit { background: #5ea12b; transition: background 0.5s ease-in-out; }
并在悬停时,将背景颜色更改为较暗的色调.
.button-submit:hover { background: #000; }
CHECK THE DEMO