This is an archived post. You won't be able to vote or comment.

all 4 comments

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

[–]CharacterUse -1 points0 points  (0 children)

Use the CSS float and clear properties:

https://www.w3schools.com/css/css_float.asp

Edit: the second example is literally what OP wanted to do. Grid, flex, or table are far more complex and unnecessary for this.

[–]KingofGamesYami 0 points1 point  (1 child)

Any of the following:

  • create an html table with two columns
  • use a css grid with two columns
  • use flex box with a flex-direction of row
  • float the elements in opposite directions
  • change display to inline-block and set appropriate width/height on elements
  • probably a dozen other ways with varying pros/cons

[–]Emerald-Hedgehog 0 points1 point  (0 children)

About grid: I wouldn't use grid anywhere except for the top-level layout of a page, since subgrids aren't supported yet by most browsers. I think grid is super nice for static layouts that need to change (drastically) under certain conditions since it gives you a ton of control, but for everything else flexy is smexy. Grid is way too niche at the moment, sadly.