Skip to content

My solution to Frontend Mentor - Profile card component.

Notifications You must be signed in to change notification settings

Max88-git/profile-card-component

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Frontend Mentor - Profile card component solution

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.

Table of contents

Overview

The challenge

Users should be able to:

View the optimal layout depending on their device's screen size

Screenshot

Above is what you should see when you click on the link below.

Links

My process

Built with

  • Semantic HTML5 markup
  • CSS custom properties
  • Flexbox
  • Animations

What I learnt

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;
}

Useful resources

  • 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.

Author