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

Frontend Mentor - NFT preview card component solution using flexbox

bem
Hồ Lê Minh Thạch•20
@MichaelHo02
A solution to the NFT preview card component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


For the hovering effect on the image to show the view-icon and changing color of the image, is there any better solution to improve that feature? I think my solution on that feature is not the best practice because I use the opacity to make the view-icon invisible.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Vanza Setia•27,715
    @vanzasetia
    Posted over 3 years ago

    👋 Hi Hồ Lê Minh Thạch!

    🎉 Congratulations on finishing this challenge! In my opinion, the best solution to make the hover effect is to use background properties and pseudo-elements. You can see my solution and take a look at the README if you want to know how to do that.

    I have some feedback on this solution:

    • Accessibility
      • All the page content should live inside landmark elements (header, nav, main, and footer). By using them correctly, you can make users of assistive technology navigate the website easily. In this case, you can wrap all of it with main tag.
    <body>
      <main>
        page content goes here...
      </main>
    </body>
    
    • The alternative text for any images should not contain any words that are related to image, like picture, photo, avatar, etc. The screen reader will pronounce them as images as long as you are using img tags.
    • You can use the creator name as alternative text for the avatar.
    • The Ethereum and clock icons are decorative. So, for any decorative images, each img tag should have empty alt="" and aria-hidden="true" attributes to make all web assistive technologies such as screen reader ignore those icons.
    • Some resources to learn about the alternative text and images.
      • Axess Lab | Alt-texts: The Ultimate Guide
      • Images Concepts • WAI Web Accessibility Tutorials
    • For decorative SVGs or images, add aria-hidden="true" attribute to the svg.
    • Use interactive elements (a) for any elements that have :hover or :active states.
    • Create a custom :focus-visible styling to any interactive elements (button, links, input, textarea). This will make the users can navigate this website using keyboard (by using Tab key) easily.
    • Changing the html or root font size can cause huge accessibility implications for those of the users with different font sizes or zoom requirements. Read what an accessibility expert (Grace Snow) has said about it.
    • Styling
      • I would recommend letting the element inside the card decide the height of it.
      • Right now, the card gets cut off on mobile landscape view (640px * 360px).
    • Best Practice (Recommended)
      • I would recommend using the .gitignore that has been provided by Frontend Mentor. That way you can prevent your GitHub repo having .DS_Store file(s). Also, make sure to upload it to the GitHub repo, so that if someone else (might be you in the future) wants to improve the solution, he/she/you don't need to set the .gitignore file.
      • Put all the CSS in a separate CSS file. Don't mix the HTML and CSS 🙂.
      • Prefer unitless for 0 value.
    * {
          padding: 0;
          margin: 0;
          box-sizing: border-box;
    }
    

    That's it! Hopefully, this is helpful!

    Marked as helpful
  • Corvida Raven•680
    @SheGeeks
    Posted over 3 years ago

    I'm not sure about best practices with opacity, but I used that property as well to get the effect . Alternatively, you could try using visibility instead.

    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