How Do I Use CSS Transition And Transform Properties

admin_img Posted By Bajarangi soft , Posted On 06-11-2020

Using CSS we can rotate div element by specified transition duration.So today we discuss how to do it.

How Do I Use CSS Transition And Transform Properties

In CSS we can Rotate 360 degree on mouse hover For div element with transition time.

<style>
    body {
        background: #ff944d;
    }
    .div1 {
        width: 100px;
        height: 100px;
        background: #b34700;
        transition: width 2s, height 2s, transform 2s;
        color: white;
    }

    .div1:hover {
        width: 300px;
        height: 300px;
        transform: rotate(180deg);
    }
    .well{
        height: 200px;
    }
</style>


Complete Code For Using CSS Transition And Transform Properties.
 
<!DOCTYPE html>
<html>
<head>
    <title>How Do I Use CSS Transition And Transform Properties</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"/>
</head>
<style>
    body {
        background: #ff944d;
    }
    .div1 {
        width: 100px;
        height: 100px;
        background: #b34700;
        transition: width 2s, height 2s, transform 2s;
        color: white;
    }

    .div1:hover {
        width: 300px;
        height: 300px;
        transform: rotate(180deg);
    }
    .well{
        height: 200px;
    }
</style>
<body>
<br/><br/>
<div class="container">
    <br>
    <div class="text-center">
        <h1 id="color" style="color: white;"> CSS Transition And Transform Properties</h1>
    </div>
    <br>
    <div class="col-md-12">
        <div class="well">
           <div class="col-md-6">
               <div class="div1" id="div1">linear</div><br>
           </div>
        </div>
    </div>
</div>
</body>
</html>

Related Post