html animation source code




!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML Animation</title>
<style>
    /* Define the animation */
    @keyframes example {
        0% {background-color: red; left: 0px; top: 0px;}
        50% {background-color: yellow; left: 200px; top: 0px;}
        100% {background-color: red; left: 0px; top: 0px;}
    }

    /* Apply the animation to a div */
    .box {
        width: 100px;
        height: 100px;
        background-color: red;
        position: relative;
        animation-name: example;
        animation-duration: 4s;
        animation-iteration-count: infinite;
    }
</style>
</head>
<body>

<div class="box"></div>

</body>
</html>

In this code:

  • We define a CSS animation called example le using @keyframes.
  • This animation gradually changes the background color and position of a box element.
  • The animation is applied to a div element with the class .box.
  • The animation duration is set to 4 seconds, and it repeats infinitely.

Comments

Popular posts from this blog

Cute Lamp Login Page

Header Animation | Bold Text & 3D Effect | CSS Tutorial|Cursor animation effect using html css js

Portfolio website