Answers for "how to animate div in css"

CSS
20

css animation

<style>
.my-element {
  width: 100%;
  height: 100%;
  animation: tween-color 5s infinite;
}

@keyframes tween-color {
  0% {
    background-color: red;
  }
  50% {
    background-color: green;
  }
  100% {
    background-color: red;
  }
}

html,
body {
  height: 100%;
}
<style>

<body>
	<div class="my-element"></div>
</body>
Posted by: Guest on May-09-2020
0

adding animation to images css

basic animation drop

//drop is variable named for the animation

@keyframes drop {
	0% {
		opacity: 0;
		transform: translateY(-80px);
	}
	100% {
		opacity: 1;
		transform: translateY(0px);
	}
}

img {
animation: drop 500ms ease;
}
Posted by: Guest on October-18-2020
20

css animation

<style>
.my-element {
  width: 100%;
  height: 100%;
  animation: tween-color 5s infinite;
}

@keyframes tween-color {
  0% {
    background-color: red;
  }
  50% {
    background-color: green;
  }
  100% {
    background-color: red;
  }
}

html,
body {
  height: 100%;
}
<style>

<body>
	<div class="my-element"></div>
</body>
Posted by: Guest on May-09-2020
0

adding animation to images css

basic animation drop

//drop is variable named for the animation

@keyframes drop {
	0% {
		opacity: 0;
		transform: translateY(-80px);
	}
	100% {
		opacity: 1;
		transform: translateY(0px);
	}
}

img {
animation: drop 500ms ease;
}
Posted by: Guest on October-18-2020

Browse Popular Code Answers by Language