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

Profile card component

Yazdun•1,310
@Yazdun
A solution to the Profile card component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


I'm going back to my previous challenges and improve them one by one, I used plain css instead of scss as I thought scss is a overkill for this one. Also I added some animations to the design to make it look a little bit cooler !

I'll be glad to know what you guys think about this solution

Code
Couldn’t fetch repository

Please log in to post a comment

Log in with GitHub

Community feedback

  • Alex•2,010
    @AlexKMarshall
    Posted over 3 years ago

    That looks great. I particularly like the polished readme file too, makes a great first impression.

    For the solution itself, I think there are too many heading elements. The user's name makes sense to be the heading for the card, but I think the others don't makes sense as headings. They're not labelling something or defining a new section.

    I'd maybe structure it something like:

    <main>
      <h1>My Page</h1>
      <article>
        <h2>Victor Crest <span>26</span></h2>
        <p>London</p>
        <ul>
          <li><span>80k</span> <span>Followers</span></li>
          <li><span>803k</span> <span>Likes</span></li>
          <li><span>1.4k</span> <span>Photos</span></li>
        </ul>
      </article>
    </main>
    

    That way you can probably avoid adding too many wrapper divs to that as well.

    It might be neat to model the bottom section as a definition list, rather than a regular unordered list, but the problem is in the design the term <dt> (Followers) comes below the definition <dd> (80k). And for the html to be valid the dd must come before the dt. You could flip the visual order using flex-order, but then that would violate https://www.w3.org/TR/WCAG20-TECHS/C27.html

    I like the animation on the profile photo, that's cool. Make sure you switch it off in a media-query for users with prefers-reduced-motion. You can see an example of how to do that in https://piccalil.li/blog/a-modern-css-reset/

    Marked as helpful
  • Mark Mitchell•1,820
    @markup-mitchell
    Posted over 3 years ago

    I'm impressed by your commitment to browser fallbacks! I should probably think about that a bit more when there's no tooling to add them automagically...

    To me the heading hierarchy seems odd - if the user's age is h2 and location is h3 that suggests to me that location is a subsection of age, which doesn't make sense to me.

    Similarly, the card__profile-stat nodes seem backwards; you could make those divs into sections and reverse the order of the h and p for a better result (IMO):

    <section class="card__profile-stat">
        <h3>Followers</h3>
        <p>80K</p>
    </section>
    

    Re-ordering visually them with flex-direction won't affect their order in the document:

    .card__profile-stat {
        display: flex;
        flex-direction: column-reverse;
    }
    

    Oh, I'd leave the alt tags on your circles blank too, like you have some other images.

    Marked as helpful
  • zhenhuamo•0
    @zhenhuamo
    Posted 3 months ago

    If you're looking to convert RGBA color values to hexadecimal (HEX) codes, https://rgbatohex.com/ is a handy online tool. It offers real-time previews, professional color schemes, and seamless copying, making color conversion straightforward and efficient.

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 1st-party linked stylesheets, and styles within <style> tags.

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.

Frontend Mentor for Teams

Frontend Mentor for Teams helps companies and schools onboard and train developers through project-based learning. Our industry-standard projects give developers hands-on experience tackling real coding problems, helping them master their craft.

If you work in a company or are a student in a coding school, feel free to share Frontend Mentor for Teams with your manager or instructor, as they may use it to help with your coding education.

Learn more

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