Right now, when two grid items share the same row and column they overlap each over.
<div class="some-grid-container">
<div style="grid-row: 1; grid-column: 1">Item 1</div>
<div style="grid-row: 1; grid-column: 1">Item 2</div>
</div>
How do I them not overlap? Probably behave like flex items when sharing the same row and column. (Without making an outer container).
Solution, set an explicit minimum not to auto To avoid the minimum width/height calculation size, you should therefore set the minimum width or heigth to another value than auto . And as you can see: the first column does not overflow anymore. the two columns share 50% of the space as specified in the fraction.
The grid-row-gap property defines the size of the gap between the rows in a grid layout. Note: This property was renamed to row-gap in CSS3.
Your syntax is not correct. Inline styles are not using those braces "{", "}". And additionally you need to specify the "Item 2" in the second column. If you use the same row and same column then both divs are in the same place for sure.
Try...
CSS:
.some-grid-container{
display: grid;
grid-template-columns: auto;
}
HTML:
<div class="some-grid-container">
<div style="grid-row: 1; grid-column: 1;">Item 1</div>
<div style="grid-row: 1; grid-column: 2;">Item 2</div>
</div>
This should create a 100% width grid with 2 equally sized columns.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With