CSS3 Transition Shorthand Property

CSSWeb DevelopmentFront End Technology

The transition shorthand property allows us to specify transition-property, transition-duration, transition-timing function and transition-delay as values to transition property in one line.

Following is the code for transition shorthand property in CSS −

Example

 Live Demo

<!DOCTYPE html>
<html>
<head>
<style>
.container div {
   width: 300px;
   height: 100px;
   border-radius: 1px;
   background-color: rgb(25, 0, 255);
   border: 2px solid red;
   transition: border-radius 2s ease 1s, background-color 2s ease-out 1s ;
}
.container:hover div {
   background-color: purple;
   border-radius: 50%;
}
</style>
</head>
<body>
<h1>Transition shorthand property</h1>
<div class="container">
<div></div>
</div>
<h2>Hover over the above div to change its color and its shape to oval</h2>
</body>
</html>

Output

The above code will produce the following output −

raja
Published on 11-May-2020 09:53:15
Advertisements