Is it better use flex or grid or other approaches for this type of layout ?

No description
11 Replies
Simon
Simon2w ago
I tend to think ahead of time and pick whatever provides simplicity, maintainability and effectively covers the most occurring edge cases. Without any context or content even a table could make sense tho, since there likely will be data after this row and with what the text and sorting-button suggests
13eck
13eck2w ago
1. What have you tried already? 1. What was easier for you to do? 1. What pain points did you have trying to make this layout? 1. What do you think?
kamekameha
kamekamehaOP2w ago
ok2 usually i always use flex and yeah let me try first and see after i watched kevin grid video, i just feel like grid can cover all flex case, but flex not 100% can...
13eck
13eck2w ago
Just off the top of my head, I see an outer flex container for the three categories. Flex and not grid so you can dynamically space them based off of the width of the parent element (probably put a max width or something so it's not full-width on a 4k monitor :p)
kamekameha
kamekamehaOP2w ago
yeah there is max width around 2000px
13eck
13eck2w ago
For the inner elements, it could either be grid to force the elements in the right place. It could be flex to allow for some flexibilty. Or just a div with float: left; on the image. Lots of ways to do it
kamekameha
kamekamehaOP2w ago
yeah i have implemented using flex it works well what if a design like this ? @13eck so how to solve this design problem ?
kamekameha
kamekamehaOP2w ago
this is what i want to achieve
No description
kamekameha
kamekamehaOP2w ago
@13eck @Simon if you guys have any idea better than this let me know, so i have trie make the character and button as a separate component but the other as background, but there is a problem with this approach when we resize the background will stretched...
13eck
13eck2w ago
What does your code look like right now? what's the issue(s) you're having? You really haven't given us much to go on, here
Simon
Simon2w ago
If you could provide an isolated code-snippet of your issue, using services like codepen.com, that be great. Doesn't have to be a perfect replica with the images – there are placeholder image sites too to grab a quick copy-paste from.

Did you find this page helpful?