Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Responsive landing page using Flexbox and CSS Grid

@gchristofferson

Desktop design screenshot for the Typemaster pre-launch landing page coding challenge

This is a solution for...

  • HTML
  • CSS
2junior
View challenge

Design comparison


SolutionDesign

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! ๐Ÿ‘

Community feedback

P
Graceโ€ข 27,950

@grace-snow

Posted

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

2

@gchristofferson

Posted

Hey @grace-snow!

Thank you for that awesome feedback!!!๐Ÿ‘๐Ÿ˜€

Some of your suggestions I implemented were changing the font-sizes to rem, moving the features section to the main element, changing the aria-labels to aria-labelledby, adding a h2 to the features section with a sr-only class, adding the overflow-x hidden to the body and fixing the alt text for the logo and using anchor tags instead of buttons for the links. Your suggestions helped me improve the structure and accessibility of my solution. Thank you so much!! ๐Ÿ™Œ

I had a couple of questions about your feedback if you have time to answer:

  • When changing my font sizes to rems, I also changed the line-height from pixels to rems. Was that a good idea, or would ems be better in this case so that the line-height scales in proportion to the text??
  • I used your sr-only class from your solution to the 3 card column preview. I hope that was ok๐Ÿ˜ณ. I understood what the class did except for these two properties: -- clip: rect(1px, 1px, 1px, 1px) and white-space: nowrap. When I toggled these off, I saw no difference. I was just wondering what these do actually?
  • About using anchor tags for buttons, I am a little confused because I thought using a button was better for buttons, since they have accessibility built in. Should I only be using buttons for user actions and not links?
  • I use a hard reset in my style sheet: *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; } Is this not recommended? Resets are another thing I'm confused about. Some recommend the above, others say it should be avoided, while others use very long reset scripts. What is best practice here???
0
P
Graceโ€ข 27,950

@grace-snow

Posted

Well done @gchristofferson , fast work!

  1. Line height should be unitless or % (eg line height 1.5)
  2. Thatโ€™s not my snippet, itโ€™s widely established across the web. Those properties address browser quirks to ensure content is visually hidden
  3. Al interactive elements โ€œhave accessibility baked inโ€. But you have to use the right ones for the job. Always anchor tags for navigation, buttons for actions
  4. Itโ€™s all opinion, but I think itโ€™s better to have a larger reset to remove browser default styles. I like Andy Bells modern reset , but adjust it very slightly for myself

Marked as helpful

1

@gchristofferson

Posted

Thanks @grace-snow! You're the best๐Ÿ‘ I'll be fixing those line-heights too. ๐Ÿ˜Š

0
Jimmy Sweeneyโ€ข 350

@sweenejp

Posted

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!

2

@gchristofferson

Posted

Hey @sweenejp!

Thanks for that feedback! You were right about the fact that overflow wasn't doing anything and that I achieved the effect with flex-wrap: no-wrap as you said. I only needed to keep overflow on the grid container for the desktop layout. Thank you so much for helping me clear that up! ๐Ÿ™Œ

1

Please log in to post a comment

Log in with GitHub
Discord logo

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