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

NFT preview component using HTML and CSS

Renardo Pine•50
@Pinedevs
A solution to the NFT preview card component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


I found it really difficult to align the bottom text (created by..) with the avatar image. In the end, I had to hard code it in. How could I center the text to the center of the image?

Any tips/methods would be really appreciated.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • IRVINE MESA•1,835
    @DrMESAZIM
    Posted almost 3 years ago

    Hi Renardo

    There are two easy ways to center the text which is use either flexbox or grid framework. In combination of text-align and justify-content properties .Align item center sets the content at the center

    If you find it difficult to resolve let me on and I can do YouTube video editing your code.

    Marked as helpful
  • David•7,960
    @DavidMorgade
    Posted almost 3 years ago

    Hello Renardo, congrats on finishing the challenge!

    The best way to get the desired result you are asking on the question is using flexbox, you could wrap both items inside of a div and the in the div use:

    div {
      display: flex;
      justify-content: space-between / around
      align-items: center;
      gap: // the space you need between the two elements
      paddding: // the padding you need to make it look like the challenge
    }
    

    Try it for you nexts projects, hope my feedback helped you!

    Marked as helpful
  • Dodeun•250
    @Dodeun
    Posted almost 3 years ago

    Hey !

    You asked how you could align the text to the center of the image. An easy way to do this is use Flexbox. I saw you used it in your body to center the card on the page.

    You can wrap your image and your text in a div, you then display: flex on this div and then can use align-items: center to do what you are looking for. Then you can apply a gap to this same div for the spacing between the image and the text, or use a margin on either one if you like it better.

    Gl hf !

    Marked as helpful
  • imad•3,330
    @imadvv
    Posted almost 3 years ago

    This comment was deleted almost 3 years ago

  • Pulkit saxena•870
    @Pulkit-s21
    Posted almost 3 years ago

    @Pinedevs Congrats on completing this challenge. For the last created by section put both the image and the text inside a div and then

    1. display: flex;
    2. align-items: center;

    Align item center sets the content at the center of the cross-axis and by default cross axis is verticle so that shoud get the text to be centered with the image

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

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