Design comparison
Solution retrospective
The <picture> element adds an extra 3px at the bottom of the image which I wasn't able to fix so any help on that is greatly appreciated. Apart from that please make sure to tell me any way I could optimize my code or make it follow best practices without hesitation :)
Community feedback
- @fermopPosted almost 2 years ago
Hi Matteo, how are you?
Answering to your question, you can get rid of that white space by doing the following:
.product-showcase { width: 100%; display: block; <-- }
The img tag has a
display: inline
by default, which adds that white space.Suggestions
- You have one accessibility report and it's because your
img
tag doesn't have analt
attribute. Images must have alt text unless it is a decorative image, for any decorative image eachimg
tag must have emptyalt=""
. - I highly recomend you to always use rem, this way your page will always be responsive to any user's settings. There's a VS Code extension that converts px to rem and viceversa by tapping
alt
+z
. The extension is px to rem by Marco N.
The rest looks great! 🎉
Hope it helps! any questions feel free to answer this comment. :)
Marked as helpful2@matteoprendiPosted almost 2 years ago@fermop Thanks for the helpful tips, the image is working just fine now. About the width though, I read online (GeeksForGeeks I think, not too sure though) that if you only have two devices (only mobile and desktop) it's better that you set the width a bit bigger than the breakpoint for individual components, does that have any truth to it or should I be more careful about what I read?
Edit: just checked through the HTML for the image without alt, am I supposed to put an empty alt tag even though it is an SVG? Is there any tag that I can use that is optimized for SVG?
0 - You have one accessibility report and it's because your
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