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

nft-preview-card-component _ HTML+CSS

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

Solution retrospective


feedbacks are welcome! i couldn't use right way for picture with hover, any useful comments?

Code
Loading...

Please log in to post a comment

Log in with GitHub

Community feedback

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

    Hello there, @ab2halim! 👋

    Like @obaidash99 has said to you earlier that I suggest wrapping the img element inside the anchor tag instead of using background properties. Then, once done that you can add alternative text to the image. The alternative text will work as the text content of the anchor tag.

    After that, you can make the active states using pure CSS with pseudo-elements and background properties. This way, it will prevent the HTML markup from having decorative element.

    I would not recommend specifying the width and the height for each element. The only thing that it needs to make the site responsive is a max-width on the card element. The other element would have width: 100%.

    Also, there's no need for absolute positioning. Instead, I would recommend using flexbox to align the icon with the text. In my opinion, using flexbox is a more robust solution because the content is not out of the normal flow.

    That's it! Hope this helps.

  • Obaida Shurbaji•250
    @obaidash99
    Posted over 3 years ago

    Nice job you did here.

    I think it is better to put the main image inside its own tag in the index.html file, not as a background of the anchor tag.

    Make the hover effect for all elements you want by creating pseudo-elements for the photo, ::before-element as the green background and ::after-element as that eye icon. giving both the pseudo-elements and the image a ' transition: 0.3s; ' if you want a smooth effect.

    Hope it helps. Obaida

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