Design comparison
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-meloniPosted over 2 years ago
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 helpful0@bhautik1206Posted over 2 years ago@albana-meloni Hey thank for giving me feedback i will definitely change this soon.....
0 - @CaioAlberto97Posted over 2 years ago
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 GitHubJoin 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