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

Tokelo Maloiโ€ข 120

@TK-LS97

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


Any Feedback is Welcome

Community feedback

Faisal Alharbiโ€ข 330

@LovelyFaisal

Posted

Hi! You've done great ๐Ÿ’ช

if you want to center the component using flexbox add height: 100vh; to the .bigdiv like this :

.bigdiv {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

and remove margin-top: 175px; from .container If you want to make it a little higher add margin-bottom: 50px; to .container

you can learn more about flexbox Here

Marked as helpful

0

Tokelo Maloiโ€ข 120

@TK-LS97

Posted

@LovelyFaisal Thank you, this will help a lot since I'm new to responsive design and flexbox.

0

@RamunnoAJ

Posted

๐—›๐—ฒ๐˜† ๐—ง๐—ผ๐—ธ๐—ฒ๐—น๐—ผ! Congratulations on completing this challenge. Your solution is almost done! I have some tips to share with you.

Use the ๐—ง๐—›๐—˜ ๐—ฃ๐—œ๐—–๐—ง๐—จ๐—ฅ๐—˜ ๐—ง๐—”๐—š that is a shortcut to deal with the multiple images in this challenge. So you can use the <picture> tag instead of importing this as an <img> or using a div with background-image. Use it to place the images and make the change between mobile and desktop, instead of using a div or img and set the change in the css with display: none with the tag picture is more practical and easy. Note that for ๐—ฆ๐—˜๐—ข / ๐˜€๐—ฒ๐—ฎ๐—ฟ๐—ฐ๐—ต ๐—ฒ๐—ป๐—ด๐—ถ๐—ป๐—ฒ reasons isnโ€™t a better practice import this product image with CSS since this will make it harder to the image. Manage both images inside the <picture> tag and use the html to code to set when the images should change setting the device max-width depending of the device ๐—ฑ๐—ฒ๐˜€๐—ธ๐˜๐—ผ๐—ฝ + ๐—บ๐—ผ๐—ฏ๐—ถ๐—น๐—ฒ.

Check the link for the ๐—ผ๐—ณ๐—ณ๐—ถ๐—ฐ๐—ถ๐—ฎ๐—น ๐—ฑ๐—ผ๐—ฐ๐˜‚๐—บ๐—ฒ๐—ป๐˜๐—ฎ๐˜๐—ถ๐—ผ๐—ป for <picture> in ๐—ช๐Ÿฏ ๐—ฆ๐—–๐—›๐—ข๐—ข๐—Ÿ๐—ฆ: https://www.w3schools.com/tags/tag_picture.asp

See the example below:

<picture>
  <source media="(max-width:90em)" srcset="./images/image-product-mobile.jpg">
  <img src="./images/image-product-mobile.jpg" alt="Gabrielle Parfum">
</picture>

โ€ข The ๐—”๐—น๐˜ ๐—ง๐—ฎ๐—ด ๐——๐—ฒ๐˜€๐—ฐ๐—ฟ๐—ถ๐—ฝ๐˜๐—ถ๐—ผ๐—ป for the image needs to be improved upon. You want to describe what the image is; they need to be readable. Assume youโ€™re describing the image to someone.

โ€ข The old price is not being announced properly to screen readers. You want to wrap it in a <del> element instead of a <p> and include a sr-only text explaining that this is the old price.

๐Ÿ‘จโ€๐Ÿ’ปHere's my solution for this challenge if you wants to see how I build it: https://www.frontendmentor.io/solutions/responsive-card-component-html-css-sOnpd3gyk0

๐—›๐—ฎ๐—ฝ๐—ฝ๐˜† ๐—ฐ๐—ผ๐—ฑ๐—ถ๐—ป๐—ด!

Marked as helpful

0

Tokelo Maloiโ€ข 120

@TK-LS97

Posted

@RamunnoAJ Thank you so much, this is really helpful, I struggled a lot with the images especially and I'm looking forward to improving this with your suggestions.

1

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