Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

NFT preview card with basics

CRKNO 50

@CriKno

Desktop design screenshot for the NFT preview card component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


Please tell me how I can improve, whatever it is fine! Thank you so much!

Community feedback

Radasin 620

@Radasin

Posted

Place an image inside an image: html<img class="img"><img class="overlay" /></img>

css

.overlay {
display: none;
width: 100%;
height: 100%;
position: relative;
z-index: 2; 
}

.img:hover .overlay {
 display:block;
} ```
this should work i haven't tested it but it should work.
1

CRKNO 50

@CriKno

Posted

@Radasin thank you so much!! I will try and I will tell you how it went.

0
Radasin 620

@Radasin

Posted

@CriKno I tested it it doesnt work. This works. You need to wrap the img in a container then set the container position to relative, overlay img to position absolute top: 0; left: 0;

<div class="div">
      <img class="img" src="1.jpg" alt="">
      <img class="overlay" src="2.jpg" alt="">
</div>

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    display: none;
    z-index: 2;
    opacity: 0.5;
}
.img {
    width: 600px;
   height: 600px;
}
.div {
    position: relative;
    width: 600px;
    height: 600px;
}

.div:hover .overlay {
    display:  block;
    max-width: 600px;
    height: 600px;
}

Marked as helpful

1
CRKNO 50

@CriKno

Posted

@Radasin I have it! I used a div container and position absolute and it work, I also change the opacity of the main image and the result is the same as in the design. Thanks for your help, It helped me a lot!

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord