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

Preview card component with HTML CSS Bootstrap and Javascript

@UtkuKaanArasan

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- Style document had some details missing such as which color to use when hovering.

2- I used javascript to check for width and then changed the photo depending on the width, maybe there is a better solution.

3- Is there any better solution for mobile picture.

Community feedback

David 8,000

@DavidMorgade

Posted

Hello Utku, congrats on finishing the challenge!

To answer your question 2 and 3, yes there is a better approach without JS that can be quite better.

You can get the same results using html, instead of using an img tag you can use 2 <source> tags and put the mobile version on one and the desktop in the other, inside the source tag you can specify the width, just like you would do in media querys, also remember that this tags have to be wrapped in a <picture></picture> tag.

Hope my feedback helps you in future projects, if you have any questions about implementing this don't hesitate to ask, good job getting the challenge done!

Marked as helpful

1

@UtkuKaanArasan

Posted

@DavidMorgade It works thx. Now gonna update it.

1

@AlejandroArigon

Posted

Hello Utku Kaan Arasan! in the folder called "images" you have an image that is for the mobile version "image-product-mobile.jpg"

to center the element I would change the body looking like this:

body{
    background-color: var(--primary-cream);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

Hope it helps, great job!

Marked as helpful

0

@UtkuKaanArasan

Posted

@AlejandroArigon Thanks, missed this detail.

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