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

NFT preview card component

Dhanya•50
@dhan5a
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 don't think I got the font-sizes correct, compared to the design.

Also, I tried using root values for the colours, but in the end I had to use the hsl values as the values were not recognised.

Would love your feedback!

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Adriano•42,870
    @AdrianoEscarabote
    Posted over 2 years ago

    Hello Dhanya, how are you? I truly loved your project's outcome, however I have some advice that I hope you'll find useful:

    The main tag must be present in every HTML document so that we can recognize the main content. To fix this, wrap the main content in the main tag. Users of assistive technology will have a better navigation experience on your site thanks to the use of HTML5 landmark elements.

    To align some content in the center of the screen, always prefer to use display: flex; it will make the layout more responsive!

    Example:

    body {
        margin: 0;
        padding: 0;
        display: flex;
        align-items: center;
        flex-direction: column;
        justify-content: center;
        min-height: 100vh;
    }
    

    The remainder is excellent.

    I hope it's useful. 👍

    Marked as helpful
  • Davide Di Francesco•200
    @davdifr
    Posted over 2 years ago

    Hey, nice job!

    First, I would like to tell you that you used the declarations in :root correctly, but then you didn't use them. Personally, I don't understand why. To use white for example, you just need to use var(--white) where necessary.

    In addition, as you can see, the platform suggests using alt in images, for example: <img src="background.png" alt="background">.

    These improvements are very simple and I'm sure that with your skills they won't be a problem!

    Otherwise, the work is well done!

    Marked as helpful
  • Elaine•11,360
    @elaineleung
    Posted over 2 years ago

    Hi Dhanya, first off, I think you did a great job putting this together! About the custom variables not working, it looks like there's a trailing curly brace in line 3 of your CSS file, and I think if you try to remove that, you'd be able to use the variables (I tried it in the browser just now using your code).

    Some suggestions I have here: I'd remove the width: 50% from the body selector, and if you're hoping to put some space on the sides to prevent the component from touching the browser sides, instead of having max-width: 300px on .card, you can try width: min(90%, 300px). This declaration tells the browser to keep the width at 90% until it gets to 300px, at which point the width would be maintained at 300px as the max width.

    Lastly, about using fixed pixel values in font sizes: It's generally good practice to use relative units (such as rem), so that's something I encourage you to try as well (by default, 1 rem is 16px). One of the main reasons is because relative units allow users to have their own preferred browser/system settings and won't be locked into using fixed sizes in the code.

    (Oh, and be sure to fix add alt tags in your img elements, otherwise these would show up in your report for sure)

    Hope this helps you out!

    Marked as helpful

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 1st-party linked stylesheets, and styles within <style> tags.

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.

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