Creating Animations & Keyframes

 <!DOCTYPE html>

<html lang="en">


<head>

    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Keyframes and Animations</title>

    <style>

        .container {

            background-color: rgb(51, 45, 45);

        }


        .box {

            background-color: grey;

            width: 250px;

            height: 250px;

            position: relative;

            animation-name: suraj1;

            animation-duration: 2s;

            animation-iteration-count: 5;

            /* animation-fill-mode: alternate; */

            /* animation-timing-function: ease-in; */

            /* animation-timing-function: ease-out; */

            /* animation-timing-function: ease-in-out; */

            /* animation-delay: 5s; */

            /* animation-direction: reverse; */

             /* this is shorthand method */

            /* animation: animation-name animation-duration animation-timing-function animation-delay animation-iteration-count animation-fill-mode; */

             /* animation: suraj1 5s ease-in 1s 12 backwards; */

        }


        @keyframes suraj1 {

            from {

                width: 200px;

            }


            to {

                width: 1400px;

            }

        }


        @keyframes suraj1 {

            0% {

                top: 250px;

                left: 0px;

            }


            25% {

                top: 250px;

                left: 250px;

            }


            75% {

                top: 0px;

                left: 250px;

            }


            100% {

                top: 0px;

                left: 0px;

            }

        }

    </style>

</head>


<body>

    <div class="container">

        <div class="box">

            This is a box

        </div>

    </div>

</body>


</html>

Comments

Popular posts from this blog

Transform Property In CSS

More on CSS Selectors