How to work with CSS Transitions?

Use the transition property to work with CSS Transitions.

You can try to run the following code to implement transitions in CSS:


Live Demo

<!DOCTYPE html>
         div {
            width: 150px;
            height: 150px;
            background: blue;
            transition: width 4s;
         div:hover {
            width: 200px;
      <h1>Heading One</h1>
      <p>Hover over the below box to change its width.</p>