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

Responsive NFT component using HTML , CSS, SASS

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

Solution retrospective


Hello everyone 😎 I hope everything is okay for everyone 😃 If you have a few minutes to give me to check my code and my site will be great because you are great people I love you don't hesitate to give your criticism

Code
Couldn’t fetch repository

Please log in to post a comment

Log in with GitHub

Community feedback

  • Mahdi Aljaza'iri•250
    @MahdiAljazairi
    Posted over 2 years ago

    @steeven509 Now have I figured out why this isn't working! And tbh, it's kinda embarassing 😅

    The :hover pseudo-class must be put after .card__img, not ::before! Just like this:

    .card__img:hover::before { ... }
    

    Why? Because, according to the spec, pseudo-elements (like ::before) can't have pseudo-classes (like :hover). So you have to apply :hover to an actual element (like .card__img) for it to work.

    For that reason, the selectors in main.scss should be arranged like this:

    .card {
      ...
      &__img {
        ...
        &::before {
          ...
        }
        &:hover::before {
          ...
        }
      }
      /* rest of the selectors.. */
    }
    
    Marked as helpful
  • Mahdi Aljaza'iri•250
    @MahdiAljazairi
    Posted over 2 years ago

    Hi There! I have spotted some flaws in main.scss:

    • In line 62, the ampersand was placed incorrectly:

      :hover &{
      

      Then the output in style.css was:

      :hover .card__img::before {
      

      Which caused the ::before to appear wherever you hover on the page.

      It's no big problem, though. Just put the ampersand before :hover and thats it!

    • The font weight for .ethereum should be bold.

    • In line 94, there is .card__data-info instead of just &-info. For which the output in style.css was:

      .card__data .card__data-info {
        ...
      .card__data .card__data-info .ethereum,
      .card__data .card__data-info .clock {
        ...
      /* and so on.. */
      

      This has added an unnecessary layer of specificity. It won't break the webpage. But in terms of reusability, it might make changing the styles of this part a bit more difficult further in the code --say, in a media query, for instance. Not to mention that this actually kills the purpose of using BEM in the first place!

    Now, as well as the above, I have some suggestions for overall improvement:

    • Since you're already using Sass, why not make use of Sass variables ($xxxx), instead of CSS custom properties (--xxxx)? As long as you don't intend to alter the values of these variables via Javascript, Sass variables are the best option because they are compiled into their actual values in the output file.

      Also, CSS custom properties are not supported in Internet Explorer. So if you want users that --are forced to-- use IE to be able to view your website, this is another reason to prefer Sass variables.

    • There is an element called <hr>, short for 'Horizontal Rule'. It is used to make a break in the flow of content. Its effect isn't only visual --as you can always change how it looks like. It also gives assistive technology a hint to announce to their users this break in the content.

      This element could be used in this project for the line that seperates the author's info from the rest of the component.

    That's about it! I hope it was helpful. And as they say: Happy Coding!

    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 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