Responsive Recipe Page using Flexbox and a Mobile-First Approach
Design comparison
Solution retrospective
I'm not sure I'm proud of anything in this project. I struggled a lot and I couldn't even get it right. I mean it looks fine I think, but it doesn't look 100% the way it's suppose to in mobile view (the image isn't right) and the table isn't completely right either. But this was my first time working with tables and like I'm guessing that's what it was suppose to be because it says "The table below shows [...]", but I couldn't get it to look just right.
I hadto redo the challenge because the first time I created it desktop-first but that did not pan out so I guess if I was to redo it I would have followed my gut and used a mobile-first workflow to begin with.
What challenges did you encounter, and how did you overcome them?I encountered a lot and it really made me feel like I'm not good enough and that maybe I should do something else with my time. Sometimes I'm kind of hard on myself and I mean I haven't even been coding for more than 9 months. But the first challenge I encountered was making the site responsive when going from desktop-first so I just commented out all my CSS and did it mobile-first and then reusing the code that still worked.
The second issue was the image in mobile view. No matter what I did I couldn't get it right. I didn't really overcome it. I just decided that I needed to move on. Looking back at it I'm realizing that I could have posted a question on Discord so I think that's what I'll do next time.
The third challenge was the table. And I didn't overcome that either. I mean I think made it look alright but it's not 100% accurate. So same thing here, next time I'll post and ask about it on Discord.
What specific areas of your project would you like help with?-
The image: What was the HTML and CSS suppose to look like? How could I have made it look the way it does in the design?
-
The table at the bottom of the page: Was it suppose to be a table? I'm thinking yes because of the use of semantic HTML, but is that correct? Could I have styled it differently? Where did I go wrong?
Community feedback
- @DarekReposPosted 7 months ago
I think you did great job! Sometimes, the solution isn't straightforward. Think of it as a journey - there's always something to learn. I've struggled with similar issues myself.
Don't get discouraged! Solving problems can be complex. If you want improve styling tables, check out this link for ideas on handling tables with borders: table-with-borders-only-on-the-inside
I played with your css solution in the firefox browser using style editor. With this image just comment margin and padding on your wrapper
.card
(this is container for all elements, you have different padding's on the child element so you have to solve this)..card { /*! margin: 0 auto; */ background-color: var(--white); /*padding: 0 1.875rem; */ }
Then you see that the image behave similar to the design on mobile devices.
Moreover since all your content (without image) are in section elements ( or
main
tag element) you can simply add padding to this element. You can remove this padding in media query to disable padding on larger and desktop devices.section { padding-inline: 2rem; /* Default padding for all screens */ } @media (min-width: 530px) { section { padding-inline: 0; /* Remove default padding on larger screens */ } }
This is just an example you can use you
main
element instead ofsection
. You can try it by yourself and play more with this solution. I hope you find this helpful.Marked as helpful0@lindajensenPosted 7 months agoThank you so much for all the feedback and the kind words. I really needed to hear that @DarekRepos
0 - @BluffSet7340Posted 7 months ago
- I did my solution desktop-first then mobile. So my feedback is given from a desktop-first perspective, then adding media queries for mobile screen sizes.
-
The left and right paddings affect the image as well. A not-pseudo selector that exludes the images from being affected should work well.
-
Use a media query to get rid of the top margin for the image.
-
Super minor but you can reduce the font-weights for the titles in nutmeg (Ingredients, Instructions, Nutrition).
-
For the screen size 320px, I noticed that by reducing the padding-left of the .raspberry selector fixes the issue of the table going out of bounds. It feels like a dirty solution but seems to work.
-
You'll have to repeat the above steps for various mobile screen sizes.
-
Also minor but you could increase the padding of the "card" <div> element to make it look more like the original
-
That's all the feedback I have, everything else matches the original quite well.
-
In my social media links solution, the best feedback I got was being told that rather than focusing on the exactness of the solution, it's better to focus on responsiveness, the value of certain units, and differing layout mechanisms. I think this applies here as well.
Hope the above is helpful!
0 - @c99rahulPosted 7 months ago
Not bad at all.
Coding after 9-10 months is a tough job, and getting into a designer-coder mindset takes some time. Since I'm accustomed to working with CSS and mobile-first workflow, here are a couple of points from my side that I hope could help you a bit:
- Instead of setting padding on the parent container, you may use individual wrappers for each block i.e. the image and the content and then apply padding on them as required in the mobile and desktop views.
- I agree that the table part is tricky here. Upon setting wider horizontal padding to table cells, I always had the cells shifting their next siblings which didn't look like the expected design. Had to perform some "tweaks" to get it right.
Keep improving, that's the only way to grow.
Cheers!
0
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