jQuery Animation How to - Animate background Color rgba








Question

We would like to know how to animate background Color rgba.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.box {<!--from   w w  w.ja  v a  2s .  co  m-->
  border-style: solid;
  border-width: 1px;
  display: block;
  width: 100px;
  height: 100px;
  background-color: #0000FF;
  -webkit-transition: background-color 2s;
  transition: background-color 2s;
}

.box:hover {
  background-color: #FFCCCC;
}
</style>
</head>
<body>
  <div class="box"></div>
</body>
</html>

The code above is rendered as follows: