html - Grid column not stretching across entire row -


this question has answer here:

i have following html in html body

<div class="wrapper">   <div class="box1">one</div>   <div class="box2">two</div>   <div class="box3">three</div> </div> 

with inline-style

.wrapper {    display: grid;    grid-template-columns: 1fr 7fr; }  .box1 {    grid-column: 1 / 2;   grid-row: 1 / 1;    background-color: red; } .box2 {    grid-column: 1 / 1;    grid-row: 2 / 2;    background-color: blue; } .box3 {    grid-column: 2 / 2;    grid-row: 2 / 2;    background-color: green; } 

this might not understanding spec, explain why have change box1

grid-column: 1 / 2; 

to

grid-column: 1 / 3; 

in order make div1 span accross both columns? see https://jsfiddle.net/vyx4jacm/

grid-column short grid-column-start , grid-column-end. second number of grid-column ending grid line.

since specified 2 columns (via grid-template-columns) means there 2 column tracks , 3 column grid lines. span all of them require grid-column-end value 3, not 2.


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -