I want to make it so that two buttons underneath each other are on the left side of the page, and another two buttons underneath each other, aligned with the other buttons, on the right side of the page. I tried using a <table>
and I tried making two <div>
s, one of them with style='align-items: left;'
and one with style='align-items: right;'
and this didn’t work. Is there a solution?
3
Answers
Use Flexbox (
display: flex
) rather than a table, to achieve thisCreate an outer
div
, which we will call the "container", and two innerdiv
s, each of which will have a vertical column of two buttons.The container
div
, we need to instruct to:This will put the items at the far left and far right.
Each of the two columns can then be a flex-box too, but you want them arranged vertically, i.e.
column
format.I think this could be a useful sample:
Here I used flexbox to align two buttons to the left and right side of the screen
First, you change the display of the parent element to
display: flex;
and then
justify-content: space-between;