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

Order Summary Component

@evanhill1989

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 could I have achieved this without defining a width on my .card container?

Starting to feel like rigid widths and heights might defeat the purpose of using flex to some degree.

Community feedback

Sang Le 520

@sqle157

Posted

Hi,

Congratulations on completing your challenge! For your question, you can try to use min in your width so that it will change the width base on the smaller value.

For example, your css can be like this

.container {
   width: min(100% - 1.5rem, 450px ) // This will make the width of the container equals the width of the 
parent width minus 1.5rem on each side and it will apply when the screen is small

This is a common way to define a container that wraps around all the content.

I hope this answers your question, and have a nice day!

Marked as helpful

3

@evanhill1989

Posted

@sqle157

Ah cool approach. Much more precise than what I had. Thank you so much!

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