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

Vanilla JS & CSS

@mbeka02

Desktop design screenshot for the Intro section with dropdown navigation coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
2junior
View challenge

Design comparison


SolutionDesign

Solution retrospective


Difficulties: Managing image sizing as the page grows and shrinks. Implementing animations for the navigation (I didn't use any animation libraries)

I'm unsure about the positioning of my image as well as the size ( it doesn't occupy the full width/span of the page )-could really use help with this.

Also how should I go about switching the image based on screen size. I used a picture element and a media query. <picture>

<source media="(min-width: 650px)" srcset="images/kitten-stretching.png"> /*Something like this*/

Community feedback

Elaine 11,400

@elaineleung

Posted

Hi Anthony, great job completing this challenge! For the picture element, if you are using a mobile first approach, you can try this:

<div className="hero">
  <picture>
    <source media="(min-width: 960px)" srcset="image-hero-desktop.png" />
    <img src="image-hero-mobile.png" alt="A man typing into a laptop" />
  </picture>
</div>

If you are using a desktop first approach and then using a media query for mobile view, then just switch the images around. Basically you'd want the img image to be the view that you're writing your base CSS for without media query.

About the layout and alignment for the desktop view, have you tried using 2 columns instead of 3 in the grid? I think that's what I'd try instead, and then use the minmax on the image mainly since I think that size kind of determines the spacing and width of the other side. I'd also put in either a max-width or something like width: min(90%, 80rem) on the home grid container to keep it from being so close to the sides, and then you may need a margin-inline: auto to center it as well. For your mobile view, I'd just use a 1fr for your column instead of any minmax.

I also completed this project but I did mine in React and I used only flexbox, although I'd really love to try this again in just JS plus grid. Anyway, great job once again, and good luck!

Marked as helpful

0

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