How to Flex Grid 2 Columns using CSS
If you would like to flex grid 2 columns in CSS then you need three (3) div
s.
Step 1 – Set your HTML template
Create some HTML with this layout.
Step 2 – Container Div
Create a Parent
div that uses the Flexbox display model.
Step 3 – Child Divs
Create two (2) divs that are both 50% of the parent container.
Below we set the height to 100% of the viewport height.
Step 4 – Some gotchas to be aware of
You should also set the padding and margin to `` to make sure there is no overlap.
It is also good practice to set the border-box
as follows:
|
|
A good overall way to set these are as follows: