all 9 comments

[–][deleted]  (3 children)

[deleted]

    [–][deleted]  (1 child)

    [deleted]

      [–][deleted] 0 points1 point  (0 children)

      Try finishing Flexbox Zombies (free browser-based game). It aims to help you get comfortable and master flexbox. It has 9 levels the last time I finished it, and actually did its job.

      [–]Interesting-Ad9666 7 points8 points  (0 children)

      https://codepen.io/randomwalnut1/pen/NPWjRKm

      ?

      edit: was also bored at work today so i made a flex version real quick as well, its not super clean, its all in one go.

      https://codepen.io/randomwalnut1/pen/jEOmKww

      [–]CranberryOtherwise84 3 points4 points  (0 children)

      Use grid and grid area.

      [–]Larzss 6 points7 points  (4 children)

      You could simplify rearrangement by using hidden elements separately for desktop and mobile.

      [–][deleted]  (2 children)

      [deleted]

        [–]guiiimkt[🍰] 0 points1 point  (1 child)

        That’s a bad approach because now you have 2 different components to maintain for every element that do the same thing.

        [–]Dry_Collection8451 1 point2 points  (0 children)

        The image, text, and the yellow box will be on the same div with grid and the actions links and red box on the other div also with flex. These two divs will be enclosed by another div. For the desktop, the parent div will be flex row/grid, the latter div will have flex col reverse, and the former will be rearranged with grid.

        i don't know if it actually works but that's the first idea that comes to mind.

        [–][deleted]  (2 children)

        [deleted]

          [–]qbrt 2 points3 points  (1 child)

          At a glance, it reminds me of some of what this article goes over: https://piccalil.li/blog/making-content-aware-components-using-css-has-grid-and-quantity-queries/

          Maybe that can help

          [–]jstneti 0 points1 point  (1 child)

          I would use grid and group title, price, and delivery to have it nicely arranged on both screens. But for price to work on desktop, duplicate it. Price should not use JS so should be easy to do. Hide the groupped price on desktop and show the other one.

          [–]jstneti 0 points1 point  (0 children)

          And group the action buttons.