Responsive 3 column preview card solution using flexbox
Design comparison
Solution retrospective
Help needed
I have designed a responsive solution using flexbox. But there is one big problem. When you adjust the size of the screen, the button position gets inconsistent due to there being different amounts of text in each preview card section. Please help me to solve that.
Community feedback
- @sivakumarsPosted almost 2 years ago
Hi, Akshay.
You could use a
min-width
of9 rem
on the button to keep the button from shrinking if that is what you are asking.Or, you could scale down the font-size of the button.
Also, for each card you could make a it a flex container, with
flex-direction
set tocolumn
.Let me know if this is what you are looking for.
0@Akshay-TardePosted almost 2 years ago@sivakumars Hey Siva, thanks for the tips. But that's not what I was looking for exactly. When you shrink the width of the solution gradually, the height of the paragraphs change. As the number of words in the paragraphs are different, the paragraphs occupy different height. Different height leads to different margin-top for the button leading the button to be in different positions in the 3 different columns. This is the problem I have.
0@sivakumarsPosted almost 2 years ago@Akshay-Tarde You can use
flex-box
orgrid
for each card, which is asection
(sedan, luxury and SUV) element in your code.Flexbox with
flex-direction: column
andgap
for each card (section) will help you achieve what you are looking for and you can push the button element to the end of the card, so it always stays there irrespective of the amount of text in the card.I hope you get the idea to fix your problem with this hint.
Marked as helpful1@Akshay-TardePosted almost 2 years ago@sivakumars Hey Siva, thanks for this tip. I just applied grid on the section and then aligned and justified the button. This has mostly fixed the responsiveness issue of the button. I've marked your response as helpful. Regards.
1
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