Card Effect
HTML CODE:-
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title></title> </head> <body> <div class="container"> <div class="img"> <img src="https://images.unsplash.com/photo-1622512272112-adeced423785?w=400&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MTR8fG5hdHVyZSUyMGJhY2tncm91bmR8ZW58MHx8MHx8fDA%3D"> </div> <div class="content"> <h3>Mountain Hill</h3> </div> </div> </body> </html> |
CSS CODE:-
body{ margin: 0px; padding: 0px; display: flex; align-items: center; justify-content: center; min-height: 100vh; background-color: black; } .container{ position: relative; width: 250px; height: 250px; background-color: white; border-radius: 10px; } .container::before,.container::after{ content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: 10px; background-color: white; z-index: -1; transition: 0.5s; } .container:hover::before{ transform: rotate(20deg); } .container:hover::after{ transform: rotate(10deg); } .container .img{ position: absolute; inset: 10px; background-color: white; z-index: 1; transition: 0.5s; } .container:hover .img{ bottom: 50px; } .container .img img{ position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; } .container .content{ position: absolute; left: 10px; bottom: 10px; right: 10px; height: 50px; text-align: center; } |