Design comparison
Solution retrospective
Thanks to the experience from the previous challenge, doing this was much easier.
What challenges did you encounter, and how did you overcome them?Fit image from normal view into 'smaller device' view.
img {
width: 279px;
height: 200px;
object-fit: cover;
border-radius: 10px;
}
What specific areas of your project would you like help with?
Code review.
Community feedback
- @kodan96Posted 6 months ago
hi there! 👋
you shouldn't apply
width
andheight
directly to your elements, their child elements should determine these dimensions. If you really want to determine their width usemax-width
along with thewidth
property using relative units.You should avoid hard-coded values (pixels) most of the time. When you use these values you give up responsiveness(or you make it harder for yourself at least)..
Typically you will increase the font-size property with
@media
queries. If you have hard-coded values all over your CSS, you need to modify every element'sfont-size
. On the other hand, if you userem
-s all you need to do is changing thefont-size
in your CSS:root
selector and all your elements will have a new size based on that value.I usually use
em
forpadding and margin
for text-based elements, since their margin usually based on theirfont-size
, and again, when you change the font-size in:root
these values will scale up as well without you touching them, making your job easier and your page maintainable..Hope this was helpful 🙏
Good luck and happy coding! 💪
Marked as helpful1@kubabebePosted 6 months ago@kodan96
Thank you for your comprehensive answer. I will try to do the challenge again, following your advice.
Best Regards :)
1 - @francisco320Posted 6 months ago
to answer your second question what i do is
**<div class "img-container"> <img>
</div> them on css i made this .img-container{ width:320px } and to img img{ width:100%; height:auto; } **1
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