Learn how to shake/wiggle an image with CSS.
Step 1 : Adding HTML – Giving image path
<h2> Hover on the image</h2>
<img src="https://image.freepik.com/free-photo/adorable-brown-white-basenji-dog-smiling-giving-high-five-isolated-white_346278-1657.jpg" alt="Pineapple" width="30%" height="30%">
Step 2 : Adding Css
img:hover {
/* Start the shake animation and make the animation last for 0.5 seconds */
animation: shake 0.5s;
/* When the animation is finished, start again */
animation-iteration-count: infinite;
}
@keyframes shake {
0% { transform: translate(1px, 1px) rotate(0deg); }
10% { transform: translate(-1px, -2px) rotate(-1deg); }
20% { transform: translate(-3px, 0px) rotate(1deg); }
30% { transform: translate(3px, 2px) rotate(0deg); }
40% { transform: translate(1px, -1px) rotate(1deg); }
50% { transform: translate(-1px, 2px) rotate(-1deg); }
60% { transform: translate(-3px, 1px) rotate(0deg); }
70% { transform: translate(3px, 1px) rotate(-1deg); }
80% { transform: translate(-1px, -1px) rotate(1deg); }
90% { transform: translate(1px, 2px) rotate(0deg); }
100% { transform: translate(1px, -2px) rotate(-1deg); }
}
Complete Code and Output with look like this :
You may Also Like
By Richard
/ March 1, 2021
How To Create a Sticky Social Bar / Fixed Social Bar Using HTML / CSS Step 1 : Loading Font...
Read More
By Richard
/ February 23, 2021
Learn how to create a skill bar / Progress bar with CSS Skills bar / Progress bar is often needed...
Read More
By Richard
/ February 19, 2021
Learn how to shake/wiggle an image with CSS. Step 1 : Adding HTML - Giving image path <h2> Hover on...
Read More
By Richard
/ February 13, 2021
Learn How to Create an AutoComplete Form using HTML, CSS and Java Script Step 1) Add HTML: <!--Make sure the...
Read More
By Richard
/ February 11, 2021
How To Create a Popup Form Step 1) Add HTML Use a <form> element to process the input. <div class="form-popup"...
Read More
By Richard
/ February 5, 2021
There are many a times, when you’re going to need a countdown clock for your project. You may have an...
Read More
By Richard
/ February 1, 2021
Learn how to create a fading overlay effect to an image on hover Step 1: Adding HTML <h2>Fade in Overlay</h2>...
Read More
By Richard
/ January 21, 2021
Via this article we gonna Learn how to create a responsive slideshow with CSS and JavaScript. Step 1) Add HTML:...
Read More
By Richard
/ January 6, 2021
In Python, there is a module, which allows you to copy a mutable object so that changes made in the...
Read More
By Richard
/ December 15, 2020
What is Unity? According to Wikipedia : Unity is a cross-platform game engine with a built-in IDE developed by Unity...
Read More