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
- @sqle157Posted over 2 years ago
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 helpful3@evanhill1989Posted over 2 years ago@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 GitHubJoin 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