Design comparison
Solution retrospective
- Question about best practices: When to use grid and flex? When to use position absolute to position certain area like the number 2 in this project? What would be the alternatives beside using position absolute?
Thanks for looking at my project. Always happy to receive more feedback.
(Hopefully not the copy & paste one)
Community feedback
- @webguy83Posted over 2 years ago
To answer your first question: Use flex when it's a one dimensional grid (a one line grid). Use grid if it's a multi dimensional grid. Of course you can do it vice versa but it's much easier to do it this way. As for absolute positioning just think of it as a way of layering something on top of another element when you want to position something in an exact location specific to top, left, bottom, and right values. When I check your 2 number it displays on top of the element. Where did you want to put it?
Marked as helpful1@nottohavePosted over 2 years ago@webguy83 I think I need to be more clear on my question. I'm aware of using flex in a one dimensional line and grid in multi dimension. I can overuse flex in every 1 line design but grid is more versatile in both one and multi dimension, if that makes sense? I was wondering if I could replace grid with flex in all situations or use grid when flex does not work? Like the image carousel in this project, when I tried using flex the design break out in mobile screen, they do not want to wrap with flex-wrap. That's why I switch to grid.
- On the other hand, for the number 2, I want it to be in the center and on top of the footer element in all screen sizes. I was looking for an alternatives instead of using position absolute and relatives because I have to declare their position over and over in different media queries.
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