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

Product preview card component

danyx75β€’ 110

@danyx75

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


  1. Trying to figure out to center the object to the middle of the page
  2. Not sure wither to use max-width or min-width when making it responsive
  3. No questions

Community feedback

@MelvinAguilar

Posted

Hello there πŸ‘‹. Good job on completing the challenge !

I have some suggestions about your code that might interest you.

  • 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 {
      display: grid;
      grid-template-columns: repeat(2, 1fr) /*  Creates two columns with equal width  */
    }
    
  • The alt attribute is used to provide a text description of the image which is useful for screen reader users, assistive technology users, and search engine optimization. Add the alt attribute to the <img> tag of the product.

CSS Reset πŸ”„:

  • You should use a CSS reset. A CSS reset is a set of CSS rules that are applied to a webpage in order to remove the default styling of different browsers.

    CSS resets that are widely used:

I hope you find it useful! πŸ˜„ Above all, the solution you submitted is great!

Happy coding!

Marked as helpful

1

danyx75β€’ 110

@danyx75

Posted

@MelvinAguilar thank you for the info I'll make sure I'll give these a shot! 😁

0
Hassia Issahβ€’ 50,670

@Hassiai

Posted

Replace<div class="container">with the main tag and <div class="attribution"> with the footer tag to fix the accessibility issues. click here for more on web-accessibility and semantic html.

To center .container on the page using flexbox, replace the height in the body with min-height: 100vh.

To center .container on the page using flexbox:
body{
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
To center .container on the page using grid:
body{
min-height: 100vh;
display: grid;
place-items: center;
}

Hope am helpful.

Well done for completing this challenge. HAPPY CODING

Marked as helpful

1

danyx75β€’ 110

@danyx75

Posted

@Hassiai thank you for this information I really do appreciate it! I'll make sure I'll give this a shot!

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