Design comparison
SolutionDesign
Solution retrospective
How can I fit the image to 100% in desktop view without object fit as some part is getting cropped? I tried giving just width: 100% for the img in desktop view but it was going beyond the card width and height. If I gave the height of the img equal to the card width, the img was stretching.
Any feedback would be helpful. Thanks!
Community feedback
- @frank-itachiPosted over 1 year ago
Hello there π. You did a good job!
I have some suggestions about your code that might interest you.
HTML π:
- Wrap the page's whole main content in the
<main>
tag. - The heading order is important in the html structure so try to always start your headings and/or titles with an
<h1>
tag and then you can decrease by one if you need to use more headings in your html code. - Since the mobile design has a different image, you can use the
<picture>
tag that allows you to interchange the images depending of the viewport size. Red more about this awesome tag here
CSSπ¨:
- Avoid using absolute length units px, especially for font-size and width properties, because they are not relative to anything else so that means they will always be the same size. Instead, you can use relative lengths like em or rem. The benefit of that last one is element which has that unit will scale relatively to everything else within the page, e.g., the parent container. You can dig up about it here
I hope you find it useful! ππ Above all, the solution you submitted is greatπ!
Happy
<coding />
π!0 - Wrap the page's whole main content in the
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