Responsive landing page using Flexbox and CSS Grid

Solution retrospective
Hey everyone! 🙋♂️
This was my first 'Junior' level challenge I have tried and I have to say it was a little difficult for me, mostly due to the multiple images and shapes a that are placed off-screen in different positions at different breakpoints. I'm wondering if I used the overflow property correctly to get this to work? Also, this is the first time I've used the <picture>
element. Did I use it correctly and is this the best option when I want load different image sizes and different screen sizes? Lastly, I feel like I wrote too much code, both CSS and HTML. Is there any way I could have made my code more 'DRY'? Did I miss anything else?
Thank you for your feedback! 👍
Please log in to post a comment
Log in with GitHubCommunity feedback
- @grace-snow
Hello
Really good job overall
Here are some suggestions:
- Insert a css reset at the start of your stylesheet
- Never ever have font sizes in pixels. Use rem (or sometimes em)
- The features section element should really live within the main element
- It's better to have an sr-only h2 in that section and use aria-labelledby on the section instead of aria-label. This is partly because aria-label isn't reliably translated into different languages, and partly because that would improve the page structure. At the moment, the parent heading of those feature h3s is actually the "mechanical wireless keyboard" h2. That might be fine, but I think having a "Features" heading would be better.
- There is horizontal overflow happening on some screen sizes. Overflow-x hidden on the body would probably fix that
- I don't think you're using the right elements for the buttons. Those should almost certainly be anchor tags as they would take people to another page (trigger navigation).
- Most important change of all
<img src="./assets/shared/logo.svg" alt="logo" class="header__logo">
. This means nothing to search engines and assistive tech users. The brand logo (and therefore name) is the most important information on the page. Fix that alt text ;)
Good luck
Marked as helpful - @sweenejp
Hi Gregg,
Your solution looks pretty close to the design so good work.
One thing I notice right away is that you could have all your media queries at the end - that way you would just have two media query lines and then put all of the classes that need to update at different sizes within those media queries (instead of having a media query on all of your classes). That might just be a matter of preference though.
Another solution to loading different image sizes is to create a div with a
background-image: url(file-path.jpg)
and then update the file path with media queries..info__img-wrapper--brand { transform: translateY(13px); }
- don't know that this line is necessary.
I could be wrong but it doesn't seem that overflow is doing anything. Looks like you achieved the effect of getting images to be off screen with
flex-wrap: no-wrap
with one of the images and a negative margin with the image. Maybe there was a way to be more consistent here and use no-wrap to achieve the effect for both images?Keep up the good work!
Join 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