Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted almost 4 years ago

NFT-preview-card-component-challenge-hub

Harsha Bajaj•30
@bajajharsha
A solution to the NFT preview card component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Hey Guys Pease let me know if you have any feedback that can make it look better.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Zineb Boutaa•750
    @zineb-Bou
    Posted almost 4 years ago

    Hi, there your solution looks good,

    some suggestions that may be helpful:

    • You can use the <picture/> tag for the card image, this will allow you to set different images based on the screen viewport instead of using <div/>

    • Since the image is just purely decorative and there is no alt provided, use aria-hidden: true to hide it from the screen reader.

    • The same thing applied to the icons, we don't want the screen reader to read it since it's purely decorative.

    • You need to add the alt for the avatar image(it's an informative image), the screen reader will read the image source path if we don't add any alt text.

    • Don't use <hr> for decoration purposes, it's used for indicating if there is a transition between headers and paragraphs, you can use only CSS to draw the line using the <div> border and play with card padding to make the left and right space.

    Marked as helpful
  • Bilal•130
    @BilalMr
    Posted almost 4 years ago

    Hi, You did a great job, congratulations! I would just recommend to center the card vertically, also you can give that class .hove a cursor:pointer; and finally a bit of margin to right for the small icons (.eth img and .days img).

    Apart from that, all looks good! keep it up for the next challenges :)

    Marked as helpful
  • Neil Khatri•620
    @nkhatri7
    Posted almost 4 years ago

    Hey Harsha,

    Just a couple of things that I think will be helpful:

    1. Try to use semantic HTML, so this would be using tags such as <main> and <footer> in your code. It's better for SEO (search engine optimisation) so it's a really good thing to have in your code. For this challenge, it would be good to wrap the card within <main> tags and the attribution within <footer> tags.
    2. Watch out for the indentation in your HTML file, it looks like your tags aren't indented properly. This can make it hard for yourself and others to understand your code.
    3. You should always have a <h1> tag, this is important for SEO once again and indicates what the most important text on a page is.
    4. To center your card, you can use absolute positioning in CSS:
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      
    5. Try to avoid using px as your unit in CSS and use more relative units such as rem.

    Hope this helps :)

    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

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