Automatic line splitting in css grid
Is there a way to get automatic row overlap (the item takes up the automatic number of vertical grid cells)?
In my example, I would like cell 8 to automatically span 2 (or more) cells without explicitly specifying it span 2
. I've looked high and low for how to do this, but it doesn't seem to be possible.
I would like each cell to be a multiple of, say 100px, so that the smallest cell is 100px, if the content overflows it gets 200px high and with a lot of content 300px, etc.
In other words, I hope the css grid can automatically detect XX:
.i { grid-row: span XX; }
.grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 2fr));
grid-auto-flow: dense;
}
.grid div {
border-left: 1px solid #000;
border-top: 1px solid #000;
padding: 10px;
}
.grid div.i {
grid-row: span 2;
}
<div class="grid">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div class="i">8aslkdj ljsa lkj dasljdks lajsld jlasdl sldjslda ld jla8aslkdj ljsa lkj dasljdks lajsld jlasdl sldjslda ld jla8aslkdj ljsa lkj dasljdks lajsld jlasdl sldjslda ld jla8aslkdj ljsa lkj dasljdks lajsld jlasdl sldjslda ld jla</div>
<div>9</div>
<div>10</div>
<div>11</div>
<div>12</div>
<div>13</div>
<div>14</div>
<div>15</div>
<div>16</div>
<div>17</div>
</div>
+3
source to share