Set the speed of the hover effect with CSS


To set the speed of the hover, use the transition-duration property. To set the hover, use the :hover selector.

Example

You can try to run the following code to speed the hover effect −

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <style>
         .btn {
            background-color: yellow;
            color: black;
            text-align: center;
            font-size: 15px;
            padding: 20px;
            border-radius: 15px;
            border: 3px dashed blue;
            transition-duration: 2s;
         }
         .btn:hover {
            background-color: orange;
            color: black;
            border: 3px solid blue;
         }
      </style>
   </head>
   <body>
      <h2>Result</h2>
      <p>Click below for result:</p>
      <button class = "btn">Result</button>
   </body>
</html>

Updated on: 03-Jul-2020

9K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements