How to add transition on hover with CSS?

To add transition with hover on CSS, the code is as follows −


 Live Demo

<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1" />
   body {
      font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
      padding: 20px;
   .scaleBtn {
      display: inline-block;
      background-color: #0c1377;
      border: none;
      color: white;
      padding: 16px 32px;
      text-align: center;
      font-size: 16px;
      transition: 0.3s;
      margin: 20px;
   .scaleBtn:hover {
      transform: scale(1.5);
<h1>Transition on hover example</h1>
<button class="scaleBtn">Hover Here</button>


The above code will produce the following output −

On hovering above the “Hover Here” button −