Home >Web Front-end >CSS Tutorial >How Can I Add Smooth Hover Transitions to My Menu Background Colors?
Adding Smooth Transitions to Menu Hover Effects with transition
You're encountering an issue with transitioning the background color of menu items on hover, as shown in your CSS code. The issue stems from a potential lack of browser support for transitions.
To enable transitions in modern browsers like Safari, Chrome, Firefox, Opera, and Internet Explorer 10 , consider revising your code:
a { background-color: #FF0; } a:hover { background-color: #AD310B; -webkit-transition: background-color 1000ms linear; -ms-transition: background-color 1000ms linear; transition: background-color 1000ms linear; }
In this revised code:
Using this updated code, you should now observe a smooth fading effect when hovering over menu links in supported browsers.
The above is the detailed content of How Can I Add Smooth Hover Transitions to My Menu Background Colors?. For more information, please follow other related articles on the PHP Chinese website!