This is a solution to the Profile card component challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.
Users should be able to:
View the optimal layout depending on their device's screen size
Above is what you should see when you click on the link below.
- Semantic HTML5 markup
- CSS custom properties
- Flexbox
- Animations
I learnt a lot of layout techniques in this CSS challenge and how to structure your CSS properly. I discovered how to clip the bg-pattern-card to the card container using overflow: hidden which makes part of the content invisible. This only works for block elements with a specified height. I also learnt how to use negative margin-top to pull the img element up and over the containing element.
Here are some code snippets I am proud of:
.card {
...
overflow: hidden;
...
}
.card-header {
background-image: url(images/bg-pattern-card.svg);
background-size: cover;
height: 150px;
}
.img-holder {
width: 110px;
height: 110px;
border-radius: 50%;
border: 5px solid white;
overflow: hidden;
margin: -55px auto 20px auto;
}
- MDN CSS Overflow - This helped me for the card header pattern background. The content is clipped to fit the padding box, as the card had rounded edges but the pattern was extended on the top edges.
- MDN Margin - This was useful in removing space between the img element and the card-body.
- Website - Max Lockwood
- Frontend Mentor - @Max88-git