QP School

Full Version: Advanced transitions in CSS3
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Example:

<!DOCTYPE html>
<html>
<head>
  <title>Advanced Transitions Example</title>
  <style>
    /* Add a custom easing function to the transition */
    div {
      width: 100px;
      height: 100px;
      background-color: lightblue;
      transition: width 1s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    }
    div:hover {
      width: 200px;
    }
  </style>
</head>
<body>
  <div>Hover over this div to see the transition effect.</div>
</body>
</html>

Explanation:

Advanced transitions can use custom easing functions (cubic-bezier) to control the animation's acceleration and deceleration. In this example, the div element grows its width from 100 pixels to 200 pixels smoothly over 1 second using a custom easing function.