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

Responsive Preview Card using React, MUI and Typescript

@Gaurav4604

Desktop design screenshot for the Product preview card component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


Hi everyone! I've implemented this challenge using Flexbox, Is it viable to use Grid for the same?

What parts of my styling can be improved upon?

Community feedback

@MelvinAguilar

Posted

Hello there 👋. Good job on completing the challenge !

I have a different suggestion.

  • The best way to create two columns in CSS is to use the grid layout 📐. Using the grid layout, you can create two columns by setting the display property of the parent element to grid and then defining the number of columns you want with the grid-template-columns property.

    Example:

    <div class="container">
      <div>Column 1</div>
      <div>Column 2</div>
    </div>
    
    .container {
      max-width: 40rem;
      display: grid;
      grid-template-columns: repeat(2, 1fr) /*  Creates two columns with equal width  */
    }
    

    With Flexbox Layout, you need to set the width of each div to 50% so that they will occupy equal amounts of space in the container.

     <div class="container">
       <div  class="column">Column 1</div>
       <div class="column">Column 2</div>
     </div>
     
     .container {
       max-width: 40rem;
       display: flex;
     }
    
     .column {
         width: 50%;
     }
    

Happy coding!

Marked as helpful

0

@Gaurav4604

Posted

@MelvinAguilar Got it! Thankyou so much, I shall try this on my upcoming challenges

0

@fmanimashaun

Posted

Nice work @Gaurav4604!

Using a grid will be overkill, as flexbox will do just right for the implementation. Generally speaking, a grid will be more suited for an overall page layout than trying to align elements in a component like a card example.

Overall, you did a nice job with your implementation.

Marked as helpful

0

@Gaurav4604

Posted

@fmanimashaun Thankyou so much for your response! I shall be moving onto Junior and Intermediate challenges soon, hope to apply grid logic there.

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