I want to build a responsive layout with 2 rows using divs .
I try this jsbin: http://jsbin.com/jiyanayayi/edit?html,css,output
The first row will have three ce
you need to use also flex and flex-wrap:
.table {
display: flex;
border: solid;
}
.row {
flex: 1;
display: flex;
}
.row:first-of-type {
flex-flow: wrap;
}
.row .rowspan2 {
flex: 1 1 100%;
}
.row div {
border: solid;
padding: 1em;
flex: 1;
}
/* ============================================================== */
/* if display grid and contents is supported then you may use it */
/* ============================================================== */
/*
@supports (display:grid) and (display:contents) {
.table {
display: grid;
grid-template-columns: 25% 25% 25% 25%;
grid-template-areas: "cell1 cell2 cell3 cell3" "cell4 cell4 cell3 cell3";
border: solid;
}
.row {
display: contents/* hide them in the structure. .row respective children become sibblings *//*
}
.row:first-child> :first-child {
grid-area: cell1;
}
.row:first-child div {
grid-area: cell2;
}
.row .cell.rowspan2 {
grid-area: cell3;
/*grid-row:span 2; no need if grid-template-area is complete*//*
}
div div {
border: solid;
padding: 1em;
}
.colspan2 {
grid-area: cell4;
/*grid-column : span 2; no need if grid-template-area is complete*//*
}
}
*/
Cell 1
Cell 2
Cell 3
Cell 4
jsbin updated with @supports
uncommented : https://jsbin.com/wexisiyamo/1/edit?html,css,output