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

Profile Card

Anthony Braund•110
@abraund
A solution to the Profile card component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


A simple challenge, and yet I spent more time on this than any other.

The similarities and differences between using position and margin to shift elements were emphasised here. When shifting the avatar upwards my instinct was to go for position: absolute. This led to having to put a calculated extra margin above the text to stop it colliding with the avatar. At some point I realised I could shift the image up with negative margins alone and then the avatar would still own its own space, a nicer solution.

The relationship between pseudos and images continues to be a tricky one. An img by default has a descender, you can remove this easily in CSS, but not when you reference an image via a url(). If you put url() in content then you get a descender. If you put url() in background then it appears you do not. If in background then you need to give a size to the content otherwise it has none. I probably think that the HTML/CSS should control the size of the box an image is displayed in & not the image itself, thus I put the card pattern in the background and set height.

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 Anthony Braund'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

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner
  • Use cases

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