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

NFT-card-grid-flexbox

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

Solution retrospective


This was my first challenge on Frontend Mentor. I would be greatly appreciative if anyone can review the way I used Flexbox and Grid together and provide feedback whether there is a better solution that what I used.

Basically, I used a large Flexbox column (body tag), Grid within the main box (container), and two Flexboxes: (1) Area with the ethereum and clock icons (2) Avatar and author area

Any other feedback would be greatly appreciated!! I am sure there are ways my code could be more concise.

Thanks!!

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Remus D. Buhaianu•3,125
    @remusbuhaianu
    Posted over 3 years ago

    Congrats on completing your first Frontend Mentor challenge, Brandon!

    It must've been quite challenging, but you've successfully made it and with each project you complete, you become a more competent and capable developer.

    Regarding what you said, there are many ways to approach a project. Obviously, there are some "best practices" commonly agreed on, but other than that, a lot of stuff in the coding world is subjective. It's important to realize that how someone coded a project isn't necessarily the best or the only way to do it.

    Now, I've had a look at your design and I looked through your code as well. Here are a few suggestions / observations based on that, in no particular order:

    1. I like how you structured your HTML - it's easy to read through. You might want to check out the BEM methodology for naming your classes and also look into HTML Semantic elements as they are a best practice when it comes to structuring your code for SEO and accessibility.

    2. On the smaller device sizes, there's an issue with the scaling of the card that creates a horizontal scrollbar. You might want to consider adding a media query to resize the card, so it fits the smaller viewports, without causing any scrolling.

    3. Consider using the * selector to target all elements when using the border-box property and also resetting the margin and padding for all the elements on the page as shown in this example https://stackoverflow.com/questions/46923610/css-resetting-margin-and-padding/46923672

    4. You added the display: grid property on the container, but that in itself doesn't affect the layout of the page. Therefore, making it redundant.

    5. You can create the hover effect just using the ::after and ::before pseudo-elements. You can have a look at how I did here https://github.com/Remus432/nft-preview-card-component/blob/main/styles.scss

    6. Consider using relative units such as %, rem, vh, and vw when building your UIs instead of px. That'll allow you to build more responsive and robust UIs that look great on all devices.

    7. Instead of using display: flex on the body element, you can use display: grid and the place-content: center properties to align vertically and horizontally your card.

    8. I like how you used @import for the Google Fonts - it's a neat way to keep your code more organized. (P.S: I might be biased because that's how I also approach Google Fonts imports ;))

    9. You set the height to auto on the equilibrium image, but that's redundant since the browser automatically calculates the height of the image based on the width. You don't need that line of code there.

    All in all, you've done a great job for your first Frontend Mentor challenge and I like how you've organized your HTML and CSS. You're on the right path and with each challenge, you'll continue sharpening your skills.

    Keep up the good work, Bradon! ;)

    Marked as helpful
  • Mariam Fkini•80
    @Mariam-Rf
    Posted over 3 years ago

    Hello Brandon, I read your CSS and it's perfectly made. I have a note about the view icon because the most common solution is to add an overlay (div) on top of the image, with the icon inside of it. But the way you approached it is smart too and I like it. There's no better solution if you get right, it's just different approaches. Also, I think when it comes to grid, it's mainly left to a more complex layout with many columns and rows. That's the general opinion about it. I hope this helps and good luck :)

    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