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-review

@bhautik1206

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


while building this product my problem is that it hard for align the box I think the css part is unsure about no i do not have any question

Community feedback

Albana 40

@albana-meloni

Posted

Hi, let me recommend you this code for changing the image depending the screen's size:

<picture>
    <source srcset="desktop.jpg" media="(min-width: 1024px)">
    <source srcset="tablet.jpg" media="(min-width: 768px)">
    <source srcset="mobile.jpg" media="(min-width: 377px)">
    <img src="mobile.jpg" alt="Main Image">
</picture>

And for alignment of the box... you can do something like this:

<main>
    <div class="box"> ... </div>
</main>

And you give the main element a display of flex, align-items of center. That's it! (You can also give the box div a margin of auto) I hope that works! Good luck

Marked as helpful

0

@bhautik1206

Posted

@albana-meloni Hey thank for giving me feedback i will definitely change this soon.....

0

@CaioAlberto97

Posted

I use position: absolute; top: 0; bottom: 0; left: 0; right: 0; margin: auto; to align my container straight to the middle, just make sure that you also set the height and width.

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