Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted 9 months ago

Profile Card Component

Flávio César•340
@flaviocmb
A solution to the Profile card component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


What are you most proud of, and what would you do differently next time?

Project description: This is a perfect challenge to test your layout skills. The card layout doesn't shift, so it's also great for those that haven't dived into responsive websites yet!

Centering the stats

To center the stats like the design, I had to use Grid, setting a fixed width for each set with grid-template-columns: repeat(auto-fit, 77px). If you’re going with flexbox, you'll need to use flex-basis for each element.

The stats labels: followers, likes and photos.

I switched them from display: inline to display: block, so they break to a new line.

Removing the height of the line

To achieve the pixel-perfect height for the card, I used a pseudo-element to remove that one-pixel height from the line separating the profile header from the stats:

.ghost-line {
  position: relative;
  width: 100%;
  height: 0px;
}

.ghost-line::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background-color: var(--dark-gray);
  opacity: 0.5;
}

Wondering about the circle shape sizes?

I don’t have the Figma file for this project, but I think the shapes are:

  • Desktop: 978px square
  • Mobile: 601px square

Now you just gotta do your math to position them right like in the design! 🔎

What challenges did you encounter, and how did you overcome them?

Getting those circle shapes and the stats elements to fit just right can be a real challenge!

What specific areas of your project would you like help with?

Anything. Thank you so much for your time and effort in evaluating this.

Code
Loading...

Please log in to post a comment

Log in with GitHub

Community feedback

No feedback yet. Be the first to give feedback on Flávio César's solution.

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