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

Using position and flex

@Elmedin1232

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


What challenges did you encounter, and how did you overcome them?

I encountered a challenge where I put one image to hover over another. It was very interesting and I thought how to logically solve the challenge. I used the position and padding to center the image on another and make the size the same. It was a very fun challenge.

Community feedback

P
Lauris 220

@Edanriell

Posted

I will be honest, your image hover effect is completely broken.

For those type of effects you never use another image.

If you are not using any fancy animation libraries like gsap or framer-motion, most often you will be creating an pseudo elements :hover::before and :hover::after. One of which will be just a positioned absolute box (top: 0, left: 0), with width 100% and height 100%. Another one will be an container for png image (if background must be transparent otherwise jpg) also property background: no-repeat url("../path/to/my/cool/maybe/not/image") must be included, and also positioned absolute (top: 50%, left: 50%).

Also you must keep in mind that when you are working with pseudo elements like before and after you must specify the content: "", property and display, or those pseudo elements will not display.

And of course there is other way to do things. You can look at my example NftPreviewCardComponent Repo Keep in mind that i use Gsap for animations, so manipulated elements must be present in DOM. Also my implementation of overlay for background is not quite right, but kinda it still works with such a small project, so i sticked to easy implementation for overlay.

Marked as helpful

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