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

CSS से इमेज ओवरले आइकॉन होवर इफेक्ट कैसे बनाएं?


CSS से इमेज ओवरले आइकॉन होवर इफेक्ट बनाने का कोड निम्नलिखित है:

उदाहरण

<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous"> <style> *{    box-sizing: border-box; } .card-container {    display: inline-block;    position: relative;    width: 50%; } img {    opacity: 1;    display: block;    width: 100%;    transition: .5s ease;    backface-visibility: hidden; } .hoverText {    position: absolute;    top:0;    height: 100%;    transition: .5s ease;    opacity: 0;    width: 100%;    text-align: center; } .card-container:hover .hoverText {    opacity: 1; } .caption {    background-color: rgb(18, 53, 131);    color: white;    font-size: 30px;    padding-top:30%;    border-radius: 6px;    height: 100%;    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;    font-weight: bolder; } </style> </head> <body> <h1>Image Overlay Icon Example</h1> <div class="card-container"> <img src="https://i.picsum.photos/id/237/536/354.jpg"> <div class="hoverText"> <div class="caption"> <i style="font-size:150px" class="fa fa-paw" aria-hidden="true"></i> </div> </div> </div> </body> </html>

आउटपुट

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

CSS से इमेज ओवरले आइकॉन होवर इफेक्ट कैसे बनाएं?

इमेज पर होवर करने पर:

CSS से इमेज ओवरले आइकॉन होवर इफेक्ट कैसे बनाएं?


  1. CSS से ओवरले इफेक्ट (मोडल/पॉपअप) कैसे बनाएं? CSS से ओवरले इफेक्ट (मोडल/पॉपअप) कैसे बनाएं?

    ओवरले पूरे व्यूपोर्ट को कवर करता है (position: fixed; top: 0; left: 0; width/height: 100%)। डिफ़ॉल्ट display: none, बटन क्लिक पर JS से display: block। rgba बैकग्राउंड से पेज डिम होता है। सर्च बार और क्लोज बटन शामिल। उदाहरण <!DOCTYPE html> <html> <head> <link rel=stylesheet h

  1. CSS से स्मूथ स्क्रॉलिंग प्रभाव कैसे बनाएं? CSS से स्मूथ स्क्रॉलिंग प्रभाव कैसे बनाएं?

    CSS से स्मूथ स्क्रॉलिंग प्रभाव बनाने के लिए, कोड निम्नानुसार है -उदाहरण<!DOCTYPE html> <html> <head> <style>    html {       scroll-behavior: smooth;    }    * {       box-sizing: border-box;    }   &n

  1. CSS से पैरालैक्स स्क्रोलिंग प्रभाव कैसे बनाएं? CSS से पैरालैक्स स्क्रोलिंग प्रभाव कैसे बनाएं?

    CSS से पैरालैक्स स्क्रोलिंग प्रभाव बनाने के लिए, कोड निम्नानुसार है -उदाहरण<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1" /> <style>    body {       font-family: "Segoe