Design comparison
Solution retrospective
I’m proud to have achieved a nearly flawless design. Moving forward, I plan to explore alternative methods to further enhance responsiveness and adaptability.
What challenges did you encounter, and how did you overcome them?I initially faced challenges with achieving responsiveness, but by refining each component with targeted media queries, I successfully reached the desired outcome.
What specific areas of your project would you like help with?In the mobile view, there is a small gap between the image and its container. I’ve tried several methods to resolve it, but adjustments tend to disrupt other alignments. Assistance in removing this gap without impacting the overall layout would be greatly appreciated.
Community feedback
- @huyphan2210Posted 28 days ago
Hi, @naveenkkannan I checked out your solution and I have some thoughts:
- The issue with your
<picture>
element having extra height is due to it being slightly taller than the<img>
inside. You can see this difference more clearly by inspecting it in your browser's DevTools. - This extra height is common with inline-level elements like
<img>
that align to the text baseline by default, leaving a small gap below. This can make the container (<picture>
) appear taller than the<img>
.
Here are two ways to fix this:
- Set
vertical-align
on<img>
Adding
vertical-align: top
orvertical-align: bottom
to the<img>
removes the extra space below:picture img { vertical-align: top; /* Or use `bottom` */ // Your styles }
- Set
<picture>
todisplay: flex
Applying
display: flex
on<picture>
removes the gap since Flexbox doesn’t have the baseline alignment issue by default.Either approach should eliminate the extra space, with the
flex
method also giving you alignment control if needed!Hope this helps!
Marked as helpful0@naveenkkannanPosted 27 days agoThank you for taking the time to review my solution and provide such detailed feedback! I implemented the method you suggested, and setting the vertical-align on <img> worked perfectly to eliminate the extra height. Your guidance was really helpful @huyphan2210
1 - The issue with your
- @Lo-DeckPosted 28 days ago
Hi well done for this challenge,
It's better to use
em
orrem
instead ofpx
. FreeCodeCamp. FreeCodeCamp.I don't understand why you set a lot of
@media (min-width:768px)
, usually you set it just once. So It's hard to read your code, keep it clear, after it's a mess when you need to debug it or someone else try to read your code.Hope to be helpful.
Marked as helpful0@naveenkkannanPosted 27 days agoThank you for your feedback! I appreciate the suggestion to use em or rem instead of px for better scalability. I’ll also work on consolidating the multiple @media (min-width: 768px) rules to improve code readability. Your insights are very helpful!@Lo-Deck
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