Computer >> कंप्यूटर ट्यूटोरियल >  >> प्रोग्रामिंग >> CSS

CSS से इमेज को शेक/विगल कैसे करें?


CSS से इमेज को शेक करने का कोड निम्नलिखित है:

उदाहरण

<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> img{    width: 400px;    height: 400px;    margin:50px; } img:hover {    animation: shakeImg 0.5s;    animation-iteration-count: infinite; } @keyframes shakeImg {    0% { transform: translate(1px, 1px) rotate(5deg); }    20% { transform: translate(-3px, 0px) rotate(10deg); }    30% { transform: translate(3px, 2px) rotate(-10deg); }    50% { transform: translate(-1px, 2px) rotate(-20deg); }    70% { transform: translate(3px, 1px) rotate(-25deg); }    90% { transform: translate(1px, 2px) rotate(10deg); }    100% { transform: translate(1px, -2px) rotate(-10deg); } } </style> </head> <body> <h1>Hover over the image to shake it<h1> <img src="https://i.picsum.photos/id/551/400/400.jpg"> </body> </html>

आउटपुट

उपरोक्त कोड निम्नलिखित आउटपुट उत्पन्न करेगा:

CSS से इमेज को शेक/विगल कैसे करें?

इमेज पर होवर करने पर यह नीचे दिखाए अनुसार शेक करेगी:

CSS से इमेज को शेक/विगल कैसे करें?


  1. CSS से स्टिकी इमेज कैसे बनाएं? CSS से स्टिकी इमेज कैसे बनाएं?

    CSS से स्टिकी इमेज बनाने का कोड निम्नलिखित है:उदाहरण<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> img {    position: sticky;    top: 0;    width: 300px;  

  1. CSS से इमेज पर बॉर्डर कैसे जोड़ें? CSS से इमेज पर बॉर्डर कैसे जोड़ें?

    CSS से इमेज पर बॉर्डर जोड़ने का कोड निम्नलिखित है:उदाहरण<!DOCTYPE html> <html> <head> <style> img {    border: 8px solid rgb(0, 238, 255);    width: 400px;    height: 400px; } </style> </head> <body> <h1>Border Around Imag

  1. CSS से इमेज पर बटन कैसे जोड़ें? CSS से इमेज पर बटन कैसे जोड़ें?

    CSS से इमेज पर बटन जोड़ने का कोड निम्नलिखित है:उदाहरण<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> img{    width: 100%; } div {    position: relative;    width