Responsive omelette recipe page created with HTML and CSS

Solution retrospective
I am most proud that I was able to make the recipe page responsive on most, if not all, devices. I am also proud that I was able to get the design as close to the designs I saw in the Figma documents.
What challenges did you encounter, and how did you overcome them?I designed the page first for desktop, so using media queries to redesign it for mobile proved challenging. I created a container with a white background (where the main content is situated) for the desktop version, so turning that container into the entire page for the mobile version and readjusting the design parameters of all the other elements to fit it was a bit difficult. I'm not even sure I did it right.
What specific areas of your project would you like help with?I would like help with using media queries to make a desktop-first design mobile-responsive.
Please log in to post a comment
Log in with GitHubCommunity feedback
- @princemuel
Hi there.
I've checked out your code and overall, it looks good.
- It uses semantic HTML.
- The layout looks good on all screen sizes👌
- It is well-structured, readable...you'll need to work on reusability.
- The solution is close to the design and that's great. Chasing the Pixel-Perfect Dream
- On accessibility, some suggestions, always wrap the page content inside a landmark e.g the main element. Some other landmarks are article, footer, section(useful when coupled with aria-label or arialabelled-by).
Concerning, your request for help with making the project mobile responsive, why not try building it mobile first i.e write the base styles for mobile, then as the screen widths change, you update the relevant styles.
I see you made some updates to the recipe container's styles at each breakpoint...You could instead, create a dedicated container class with an absolute max-width say 1440px(convert to rem), a width of 100% with some padding, maybe 1 or 2rem, and a margin-inline of auto to always center the content.
I guess you already know some of this.
You can either use it to wrap each section, or the whole content.
Using it in this project should get you from mobile, all the way to the desktop without writing any media queries except for maybe font-sizes etc.
Speaking of font-sizes, since you're familiar with css variables, you could create a typescale in
:root
::root { --base-size: 1rem; /* normally 16px */ --scale: 1.25; /* adjust to your preferred */ --h1: calc(var(--h2) * var(--scale)); --h2: calc(var(--h3) * var(--scale)); --h3: calc(var(--h4) * var(--scale)); --h4: calc(var(--h5) * var(--scale)); --h5: calc(var(--h6) * var(--scale)); --h6: var(--base-size); } /* then do something like this */ body { font-size: var(--base-size); } h1 { font-size: var(--h1); } /* then at breakpoints..adjust to your preferred */ /* tablet */ @media only screen and (max-width: 768px) { --base-size: 1.3rem; } /* and so on */
This way, all you're adjusting is the scale or the base size at each screen size.
Anyways, good luck✌️
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