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

How to make image fit into the image container

@Teddyness

Desktop design screenshot for the Order summary component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


How do I make sure the Image is fits into the image container in this challenege

Community feedback

Lucas 👾 104,420

@correlucas

Posted

Hello Ted, congratulations for your new solution!

Answering your question:

All you need to do is to add background-size: contain to make the image takes the full width and background-repeat: no-repeat to avoid the svg image repeating. Doing that you'll have the correct size and alignment to the card center.

Hope this helps, happy 👏

Marked as helpful

0

@Teddyness

Posted

@correlucas

Hi Lucas,

Thank you for your feed back, I'll definitely implement this method in my next attempt.

1

@Nairitya

Posted

Hi Ted,

Congratulations 🎉 for completing this challenge, the card component looks great. Here's a solution on how you can make sure that the Image is fits into the image container :

1 ) Firstly remove the <p> tag which you have inside your <div class="img-container"> 2 ) Give both <div class="img-container"> and <div class="cont-2"> a max-width and it must be same. 3) Then give your img element these properties:

  object-fit: cover;
  width: 100%;

I hope this helped you. Happy Coding :) Keep Working Hard!!

Marked as helpful

0

@Teddyness

Posted

@Nairitya

Hi Nairitya,

Thank you for your feedback, I'll definitely implement the solutions provided by you and other members from the community.

0

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