Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted almost 2 years ago

A solution using flexbox and my first time using Sass!

sass/scss
xirb22•90
@xirb22
A solution to the 3-column preview card component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


For now I made the columns non-wrapping flex items and used a media query to create a breakpoint where the flex direction turns from row to column for the mobile view.

.card-wrapper {
    display: flex;
}

@media screen and (max-width: 750px) {
  .card-wrapper {
    flex-direction: column;
}

Is there a better way to do this, perhaps without media query? Or would grid have been a better option altogether?

Also, when resizing the desktop browser's width, the lines of the paaragraph did not break at the same time for each column which caused the buttons to stop being aligned with eachother. I solved this by putting all elements in the card in a flex column and giving the main text paragraph a flex-basis of 50%.

.card-wrapper .card {
  display: flex;
  flex-direction: column;
  align-items: start;
}

.card-wrapper p {
  flex-basis: 50%;
}

I doubt this is the best way to handle this issue, can you suggest a better way?

Thanks in advance!

Code
Loading...

Please log in to post a comment

Log in with GitHub

Community feedback

No feedback yet. Be the first to give feedback on xirb22's solution.

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

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner
  • Use cases

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License