Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Profile card solution

Tina Wang 140

@tina801005

Desktop design screenshot for the Profile card component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


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

Why is my responsive layout failing? I've redone it many times and still have problems. I'm definitely doing something wrong, but I can't find the problem.

Community feedback

P
markus 1,940

@markuslewin

Posted

Hey!

By default, the grid column that contains the card is of size auto. That means it won't shrink below the width of the card's minimum size. The image container inside the card has a width: 21rem, and so the column will never shrink below that. You probably want the image to grow/shrink with the size of the card, so remove the width: 21rem from .cardTop.

Two approaches for centering the card in a grid layout:

/* Define the size of the column and center that column */
body {
  display: grid;
  grid-template-columns: minmax(auto, 33rem);
  place-content: center;
}

or

/* Define the size of the item inside the column and center that item */
body {
  display: grid;
  place-items: center;
}

.container {
  max-width: 33rem;
  width: 100%;
}

Marked as helpful

1

Please log in to post a comment

Log in with GitHub
Discord logo

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