To create a hover animation for a button in CSS


Q. How to create a hover animation for a button in CSS?

<!DOCTYPE html>
<html>
<head>
  <style>
    .fancy-button {
      background-color: #007bff;
      color: white;
      padding: 10px 20px;
      border: none;
      transition: all 0.3s ease;
      border-radius: 5px;
    }
    .fancy-button:hover {
      background-color: #0056b3;
      transform: scale(1.1);
    }
  </style>
</head>
<body>
  <button class="fancy-button">Hover Me</button>
</body>
</html>



OnlineTpoint is a website that is meant to offer basic knowledge, practice and learning materials. Though all the examples have been tested and verified, we cannot ensure the correctness or completeness of all the information on our website. All contents published on this website are subject to copyright and are owned by OnlineTpoint. By using this website, you agree that you have read and understood our Terms of Use, Cookie Policy and Privacy Policy.