Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted about 2 years ago

NFT Preview Card Component using HTML and CSS Newbie

Daniel G Szabo•20
@d-g-Szabo
A solution to the NFT preview card component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


I improved my knowledge about grids and flex, so I implemented those. But this :hoover in the picture is really bad. Pls help me guys :D

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Mukwende•1,370
    @mukwende2000
    Posted about 2 years ago

    So this is how it works, when you give an element position: absolute, css checks if the parent of that element has a position of relative, if it does not, it checks up the dom until it finds one that has the relative position, then it will position the child in relation to that element, if it does not find any element that has a position of relative, it positions the element relative to the body. Your ntf-view is positioned absolute to the body and not the ntf-all. That is why the hover is not doing as you expect it to, to fix this just do this

    ntf-all {
    position: relative;
    }
    

    by doing this, you make the element a positioned element, so any child inside it that are given the position: absolute; will be positioned in relation to it, which means if you say

    ntf-view {
    position: absolute;
    top: 0;
    }
    

    This will make the top part of the ntf-view align with the top of its parent.

    Marked as helpful
  • João Victor Abreu•80
    @shufito
    Posted about 2 years ago

    Hello 👋. Congratulations on successfully completing the challenge! 🎉

    I have other recommendations regarding your code that I believe will be of great interest to you.

    Position of css element:

    Looking at your code I noticed that you put in your div a class with the name 'nft-view' that receives a 'position:absolute', but it doesn't have a relative div as a reference. The modifications I suggest are to add a 'position:relative' to the nft-all class and change the top to zero in the 'nft-view' class, as follows:

    .nft-all {
    position: relative
    }
    .nft-view {
    position: absolute;
    top: 0;
    width: 18.9rem;
    height: 18.9rem;
    border-radius: 3%;
    }
    

    Hope you find this useful 😄 Overall, the solution you submitted is great!

    Marked as helpful
  • Abdul Khaliq 🚀•72,380
    @0xabdulkhaliq
    Posted about 2 years ago

    Hello there 👋. Congratulations on successfully completing the challenge! 🎉

    • I have other recommendations regarding your code that I believe will be of great interest to you.

    CSS 🎨:

    • Looks like the <footer"> element has not been placed at the bottom yet. So let me explain, How you can place the component at bottom with using fixed positioning for footer


    • Luckily you already used Flex layout of css to center the component, So you just want to add fixed position for <footer> element to place it in bottom of the page
    footer {
    position: fixed;
    bottom: 1em;
    }
    

    • Now your component has been properly at bottom

    .

    I hope you find this helpful 😄 Above all, the solution you submitted is great !

    Happy coding!

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
Frontend Mentor logo

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit all CSS, SCSS and Less files in your repository.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.

How does the JavaScript validation report work?

When a solution is submitted, we use eslint to run an automated check on the JavaScript code.

The report picks out common JavaScript issues such as not using semicolons and using var instead of let or const, among others.

The report will audit all JS and JSX files in your repository. We currently do not support Typescript or other frontend frameworks.

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub