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

@TjasaZil

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


Made with Tailwindcss and Vue, tested with Jest. Any feedback is welcome :)

Community feedback

@Ahmed96Mah

Posted

Hello Tjaša,

The following ideas could help you for the mobile styles:

1- There is no need to use the position property, as the following combination affects how the image is displayed and also the layout of the '<main>' element (which will crop the top and bottom of the main container)

// So, the following lines could be removed
body {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);  // This causes main to be cropped
overflow: hidden;     // This doesn't allow you to scroll to see the remaining of the main
}

Note: if your intention of using the position property was to display the container along the whole screen (without the need to scroll), then you will have to minimize the heading's font sizes, and elements paddings and margins to achieve that goal.

2- You could leave a bit more space around the main element by setting the main's width with a vw (viewport width) unit:

main {
width: 90vw;   // Instead of using 100%
}

3- For the image, my personal opinion is that, it would have been a lot easier to deal with an image tag rather than using a div's background as an image. However, with your current solution, you can change the image's height to a more favorable value:

.image {
height: 17rem;  // the height has changed from previously set value of 23rem.
}

4- To make the button aligned correctly with the text, you could change the margin-left property (located at line 135 in main.css) to 30px.

Hope this helps.

If you have any questions, don't hesitate to ask.

Have a nice day :)

Marked as helpful

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