The CSS3 transitions are effects that allows to change property's values smoothly from one value to another, in a specified duration. These effects changes the element's property gradually from one style to another, without using flash or JavaScript.
There are two things you need to specify to create a transition :
<!DOCTYPE html>
<html lang="en">
<head>
<title> CSS 3D Transition </title>
<meta charset="UTF-8">
<style>
button {
color: #fff;
border: none;
padding: 10px 20px;
font: bold 18px sans-serif;
background: #da6e18bd;
-webkit-transition: background 2s; /* For Safari 3.0 to 6.0 */
transition: background 2s; /* For modern browsers */
}
button:hover {
background: seagreen;
}
</style>
</head>
<body>
<button type="button">Hover on me</button>
</body>
</html>
Output
CSS 3D Transition
In the example below, the width of the element is increased under hover. The transition time value is also given which will specify the
time of the transition in which it will get completed. If you take mouse cursor out of the element, it gains its original style slowly.