im trying to make a responsive section.
this is how i want it to look in desktop:
+---+---+---+--------------+
| 3 | 2 | 1 | A | <- this is right one
+---+---+---+--------------+
an this is how it should look in mobile view:
+-----------+
| A |
+---+---+---+ <- this is right one
| 3 | 2 | 1 |
+---+---+---+
tried some tutorials too but every time ending up to this:
+-----------+
| A |
+-----------+
| 1 |
+-----------+ <- this is wrong one
| 2 |
+-----------+
| 3 |
+-----------+
hope visualization helps.
i tried to make a section with 2 columns. first column has letter in it. second column has a inner section with 3 column and each column has a number in it.
could be done with grid.
one way would be to make nested grid, but simpler if you specify exactly position start and end.
body {
margin: 0;
padding: 0;
width: 100vw;
height: 100vh;
}
#grid {
display: grid;
grid-template-rows: 1fr;
grid-template-columns: 16.6% 16.6% 16.6% 1fr;
gap: 0;
width: 100%;
height: 100%;
}
#div1 {
grid-area: 1 / 3 / 2 / 4;
background-color: rgba(29, 145, 229, 0.5);
}
#div2 {
grid-area: 1 / 2 / 2 / 3;
background-color: rgba(1, 16, 21, 0.5);
}
#div3 {
grid-area: 1 / 1 / 2 / 2;
background-color: rgba(66, 202, 43, 0.5);
}
#A {
grid-area: 1 / 4 / 2 / 5;
background-color: rgba(53, 69, 26, 0.5);
}
#media screen and (max-width: 768px) {
#grid {
display: grid;
grid-template-rows: 1fr 1fr;
grid-template-columns: 1fr 1fr 1fr;
gap: 0;
width: 100%;
height: 100%;
}
#div3 {
grid-area: 2 / 1 / 3 / 2;
background-color: rgba(143, 196, 214, 0.5);
}
#div2 {
grid-area: 2 / 2 / 3 / 3;
background-color: rgba(126, 56, 58, 0.5);
}
#A {
grid-area: 1 / 1 / 2 / 4;
background-color: rgba(158, 192, 23, 0.5);
}
#div1 {
grid-area: 2 / 3 / 3 / 4;
background-color: rgba(9, 129, 51, 0.5);
}
}
<div id="grid">
<div id="div1">1</div>
<div id="div2">2</div>
<div id="div3">3</div>
<div id="A">A</div>
</div>
Here you go:
HTML:
<div class="parent">
<div>3</div>
<div>2</div>
<div>1</div>
<div>A</div>
</div>
CSS:
.parent {
display: flex;
text-align: center;
}
.parent>div {
flex: 1;
border: 1px dotted black;
padding: 30px 0;
}
.parent>div:last-child {
flex: 5;
}
You can change your media query as per your requirement.
#media only screen and (max-width:767px) {
.parent {
flex-wrap: wrap;
}
.parent>div:last-child {
flex-basis: 100%;
order: -1;
}
}
using media screen and flexbox
HTML CODE
<div class="container">
<div class="A">A</div>
<div class="3">1</div>
<div class="2">2</div>
<div class="1">3</div>
</div>
CSS CODE
*{
box-sizing: border-box;
margin: 0;
}
.container {
display: flex;
align-items: center;
flex-direction: row-reverse;
width: 100%;
height: 100vh;
}
.container div {
width: calc(100% / 3);
padding: 20px;
height: 100%;
border: 1px dotted;
}
.container .A {
width: 100%;
text-align: center;
}
#media (max-width:767px) {
.container {
flex-wrap: wrap;
height: 50vh;
}
}
Related
I need to achieve a grid item to be wider than the grid frame.
However, it seems that this is not possible with a standard way.
Any idea?
.grid {
display: grid;
grid-template-columns: 200px 200px 200px;
}
.grid-item {
position: absolute;
width: 300px;
}
As you put it, the item is already wider that its grid box. There is no need to add position absolute. For better understanding of what is going on, while working on grid, it is recomended to use firefox since it help you visualize every grid line.
.grid {
display: grid;
background-color: red;
grid-template-columns: 200px 200px 200px;
}
.grid-item1 {
background-color: blue;
width: 300px;
height: 300px;
}
.grid-item2 {
background-color: green;
width: 300px;
height: 300px;
}
.grid-item3 {
background-color: yellow;
width: 300px;
height: 300px;
}
<div class="grid">
<div class="grid-item1"></div>
<div class="grid-item2"></div>
<div class="grid-item3"></div>
</div>
body {
margin: 0;
min-height: 100vh;
display: grid;
place-items: center;
}
.container {
width: 50vw;
height: 50vh;
border: 1px solid red;
}
.grid {
width: 70vw;
height: 70vh;
margin: -10vh -10vw -10vh -10vw;
position: relative;
display: grid;
grid-template-columns: repeat(7, 10vw);
grid-template-rows: repeat(7, 10vh);
}
.c {
grid-column: 4 / -4;
grid-row: 4 / -4;
}
.n {
grid-column: 4 / -4;
grid-row: 1 / 2;
}
.s {
grid-column: 4 / -4;
grid-row: -2 / -1;
}
.e {
grid-column: -2 / -1;
grid-row: 4 / -4;
}
.w {
grid-column: 1 / 2;
grid-row: 4 / -4;
}
.ne {
grid-column: -2 / -1;
grid-row: 1 / 2;
}
.se {
grid-column: -2 / -1;
grid-row: -2 / -1;
}
.nw {
grid-column: 1 / 2;
grid-row: 1 / 2;
}
.sw {
grid-column: 1 / 2;
grid-row: -2 / -1;
}
.c,
.n,
.s,
.e,
.w,
.ne,
.nw,
.se,
.sw {
border: 1px solid #000;
}
<div class="container">
<div class="grid">
<div class="c"></div>
<div class="n"></div>
<div class="ne"></div>
<div class="e"></div>
<div class="se"></div>
<div class="s"></div>
<div class="sw"></div>
<div class="w"></div>
<div class="nw"></div>
</div>
</div>
I have a css grid:
|-------|-------------------|
|-------| |
| | overflow |
|-------|-------------------|
|-------|-------------------|
And I cannot stop the "overflow" from growing, basically it always expands, despite having set:
overflow: auto;
in the css. How can achieve this?
The snippet below.
html {
font-size: 22px;
}
body {
padding: 1rem;
/* grid-template-columns: 1fr 3fr; */
}
.wrapper {
max-height: 70vh;
padding: 1rem;
}
.header {
background-color: red;
color: white;
padding: 1rem;
height: 2rem;
resize: horizontal;
grid-area: 1 / 1 / 2 / 2;
}
.nav {
background-color: lightgrey;
color: baclk;
padding: 1rem;
height: 4rem;
overflow: auto;
min-width: 12rem;
resize: horizontal;
grid-area: 2 / 1 / 3 / 2;
}
.scroll {
background-color: dodgerblue;
color: white;
padding: 1rem;
overflow: auto;
grid-area: 1 / 2 / 3 / 3;
}
.prev {
background-color: black;
color: white;
padding: 1rem;
height: 4rem;
grid: 3 / 1 / 4 / 2;
}
.select {
background-color: lightgrey;
color: white;
padding: 1rem;
height: 4rem;
grid-area: 4 2 4 4;
}
.cards {
max-width: 1200px;
margin: 0 auto;
display: grid;
grid-gap: 0.5rem;
}
/* Screen larger than 600px? 2 column */
#media (min-width: 600px) {
.cards {
grid-template-columns: 1fr 3fr;
}
}
<div class="wrapper">
<div class="cards">
<div class="header">HEADER</div>
<div class="scroll">
<p>111</p>
<p>222</p>
<p>333</p>
<p>444</p>
<p>555</p>
<!-- <p>666</p>
<p>777</p>
<p>888</p>
<p>999</p> -->
</div>
<div class="nav">NAV</div>
<div class="prev">PREVIEW</div>
<div class="select">SELECT</div>
</div>
</div>
It turned out the solution is to add one line to the grid definition:
grid-template-rows: auto 1fr auto;
This produces a nice layout, when the "scroll" area overflows, while the grid scales as expected. Updated snippet below.
html {
font-size: 22px;
}
body {
padding: 1rem;
overflow: hidden;
/* grid-template-columns: 1fr 3fr; */
}
.header {
background-color: red;
color: white;
padding: 1rem;
height: 2rem;
grid-area: 1 / 1 / 2 / 2;
}
.nav {
background-color: lightgrey;
color: baclk;
padding: 1rem;
height: auto;
overflow: auto;
min-width: 12rem;
resize: horizontal;
grid-area: 2 / 1 / 3 / 2;
}
.scroll {
background-color: dodgerblue;
color: white;
padding: 1rem;
overflow: auto;
max-height: 70vh;
grid-area: 1 / 2 / 3 / 3;
}
.prev {
background-color: black;
color: white;
padding: 1rem;
max-height: 30vh;
grid: 3 / 1 / 4 / 2;
}
.select {
background-color: lightgrey;
color: white;
padding: 1rem;
height: 4rem;
grid-area: 4 2 4 4;
}
.cards {
max-width: 80vw;
height: 90vh;
margin: 0 auto;
display: grid;
grid-gap: 0.5rem;
}
/* Screen larger than 600px? 2 column */
#media (min-width: 600px) {
.cards {
grid-template-columns: 1fr 3fr;
grid-template-rows: auto 1fr auto;
}
}
<div class="wrapper">
<div class="cards">
<div class="header">HEADER</div>
<div class="scroll">
<p>111</p>
<p>222</p>
<p>333</p>
<p>444</p>
<p>555</p>
<p>666</p>
<p>777</p>
<!-- <p>888</p>
<p>999</p> -->
</div>
<div class="nav">NAV</div>
<div class="prev">PREVIEW</div>
<div class="select">SELECT</div>
</div>
</div>
I am looking for made a responsive design with flexbox. But i have some issues to switch between my two views. Maybe someone have an idea how to solve this problem.
.box {
display: flex;
flex-wrap: wrap;
flex-direction: row-reverse;
}
.box>* {
flex: 1 1 160px;
border: 1px solid blue;
margin: 5px;
padding: 50px;
}
.flex-item {
border: 1px solid blue;
margin: 5px;
padding: 50px;
}
<article class="box">
<p class="a">box a lorem ipsum ipsum </p>
<p class="b">box b lorem ipsum ipsum </p>
<p class="c">box c lorem ipsum ipsum </p>
</article>
You can use CSS Grid with Media Queries. Please view the output in full screen and reduce it below the desired width i.e. 600px. I have explained the code in the comments.
Output:
.grid-container {
display: grid;
grid-template-columns: 2fr 1fr; /* 2 columns of 2 fractions and 1 fraction each */
grid-template-rows: 1fr 1fr; /* 2 rows of a fraction each */
}
.box-a {
grid-area: 1 / 1 / 2 / 2; /* Start at Row 1, Start at Column 1. End at Row 2, End at Column 2 */
}
.box-b {
grid-area: 1 / 2 / 3 / 3;
}
.box-c {
grid-area: 2 / 1 / 2 / 2;
}
#media (max-width: 600px) { /* Target for screens below width of 600px */
.box-b {
grid-area: 1 / 2 / 2 / 3;
}
.box-c {
grid-area: 2 / 1 / 3 / 3;
}
}
/* Snippet Styling */
.box-a {
background: tomato;
}
.box-b {
background: lightgreen;
}
.box-c {
background: lightblue;
}
.grid-container>div {
text-align: center;
color: #fff;
font-size: 3em;
font-family: sans-serif;
padding: 10%;
}
<div class="grid-container">
<div class="box-a"> A </div>
<div class="box-b"> <img src="http://placehold.it/100"> </div>
<div class="box-c"> C </div>
</div>
In my web app I am using css grid to build a basic home page. I want the top grid item: item-1 to be as tall as possible so that the whole grid fills the viewport. See image.
So that leaves no gap at the bottom. I have tried adjusting the height of the wrapper, the row height in grid-template-rows and changing the numbers in each individual item's grid-column value. How do I make item-1 cover more of the viewport and moves the 4 items below it down to touch the bottom?
.wrapper {
margin-top: -25px;
width:100vw;
height: 70vh;
// border: 2px solid #ccc;
display: grid;
grid-gap: 3px;
grid-template-columns: repeat(4, 90px);
grid-template-rows: repeat(4, 100px);
justify-content: center;
align-content: end;
padding-bottom: 10px;
}
.box {
background-color: #444;
color: #fff;
border-radius: 5px;
padding: 10px;
font-size: 150%;
text-align: center;
}
.item-1 {
margin-top: 50px;
background-image: url(../assets/imgs/placeholder.png);
grid-column: 1 / 5;
grid-row: 1 / 5;
}
.item-2 {
grid-column: 1 / 3;
background-color: rgba(250, 250, 250, 0.1);
}
.item-3 {
grid-column: 3 / 5;
background-color: rgba(250, 250, 250, 0.4);
}
.item-4 {
grid-column: 1 / 3;
background-color: rgba(250, 250, 250, 0.4);
}
.item-5 {
grid-column: 3/ 5;
background-color: rgba(250, 250, 250, 0.4);
}
<div class="wrapper">
<div class="box item-1"></div>
<div tappable (click)="loadAbout()" class="box item-2"><i class="icon fa fa-info"></i>About</div>
<div tappable (click)="loadHowTo()" class="box item-3"><i class="icon fa fa-question"></i>How To</div>
<div tappable (click)="loadList()" class="box item-4"><i class="icon fa fa-signal"></i>List</div>
<div tappable (click)="loadContact()" class="box item-5"><i class="icon fa fa-comments"></i>Contact Us</div>
</div>
Set the wrapper grid-template-rows to auto 100px 100px.
html,
body {
font-family: Arial;
margin: 0;
padding: 0;
}
.grid {
width: 100vw;
height: 100vh;
background: #333;
display: grid;
grid-template-rows: auto 100px 100px;
grid-template-columns: repeat(4, 90px);
grid-gap: 5px;
justify-content: center;
}
.grid * {
color: white;
font-size: 120%;
background: rgba(255, 255, 255, 0.3);
display: flex;
align-items: center;
justify-content: center;
}
.grid .grid-item-1 {
grid-column: 1 / 5;
grid-row: 1;
}
.grid .grid-item-2,
.grid .grid-item-3 {
grid-row: 2;
}
.grid .grid-item-4,
.grid .grid-item-5 {
grid-row: 3;
}
.grid .grid-item-2,
.grid .grid-item-4 {
grid-column: 1 / 3;
}
.grid .grid-item-3,
.grid .grid-item-5 {
grid-column: 3 / 5;
}
<div class="grid">
<div class="grid-item-1"></div>
<div class="grid-item-2">about</div>
<div class="grid-item-3">how to</div>
<div class="grid-item-4">list</div>
<div class="grid-item-5">contact us</div>
</div>
making width: 100vh; to your .wrapper and .item-1 divs might be what you're looking for. This should omit the need for negative margins, padding-bottom and align-content properties.
Hope that helps!
.wrapper {
/* margin-top: -25px; */
width: 100vw;
height: 100vh; /* made 100vh */
/* // border: 2px solid #ccc; */
display: grid;
grid-gap: 3px;
grid-template-columns: repeat(4, 90px);
grid-template-rows: repeat(4, 100px);
justify-content: center;
/* align-content: end; */
/* padding-bottom: 10px; */
}
.box {
background-color: orange;
color: #fff;
border-radius: 5px;
padding: 10px;
font-size: 150%;
text-align: center;
}
.item-1 {
/* margin-top: 50px; */
background-image: url(../assets/imgs/placeholder.png);
grid-column: 1 / 5;
grid-row: 1 / 5;
height: 100vh;
}
.item-2 {
grid-column: 1 / 3;
background-color: rgba(250, 250, 250, 0.1);
}
.item-3 {
grid-column: 3 / 5;
background-color: rgba(250, 250, 250, 0.4);
}
.item-4 {
grid-column: 1 / 3;
background-color: rgba(250, 250, 250, 0.4);
}
.item-5 {
grid-column: 3/ 5;
background-color: rgba(250, 250, 250, 0.4);
}
<div class="wrapper">
<div class="box item-1"></div>
<div tappable (click)="loadAbout()" class="box item-2"><i class="icon fa fa-info"></i>About</div>
<div tappable (click)="loadHowTo()" class="box item-3"><i class="icon fa fa-question"></i>How To</div>
<div tappable (click)="loadFreq()" class="box item-4"><i class="icon fa fa-signal"></i>List</div>
<div tappable (click)="loadContact()" class="box item-5"><i class="icon fa fa-comments"></i>Contact Us</div>
</div>
I am trying to create three items inside of a nested grid item. As you can see from the code, I've put the 'panels' div in-between the 'jumbo' and 'content' divs. I also nested three divs inside. In the CSS, I added a nested grid inside of .panels.
I want the 'panels' div to be split in three equally size parts on the vertical axis. Imagine three square blocks stack one after another. But the nested items don't fill the entire 'panels' div. If you run the code snippet, you can see that the panels are nested but don't take up the entire space. They take up a small percentage of their parent. I added background-color: white !important to one of the nested panels to show how small it is.
Another example can be seen here: https://codepen.io/rachelandrew/pen/NqQPBR/
But again, the nested E, F and G items don't expand to fill up the entire D section.
Is there a way to make the three panels fill in their parent?
.container {
display: grid;
width: 100%;
height: 100%;
grid-gap: 3px;
grid-template-columns: repeat(10, 1fr);
grid-template-rows: 40px 130px 130px 130px 60px 330px 40px;
}
.header {
grid-column: 1 / -1;
}
.jumbo {
grid-column: 1 / -1;
grid-row: 2 / 5;
}
.panels {
grid-column: 3 / 9;
grid-row: 4 / 6;
z-index: 1;
display: grid;
grid-template-columns: repeat(3, 1fr);
}
.panel1 {
grid-row: 1 / 2;
grid-row: 1;
background-color: white !important;
z-index: 2;
}
.content {
grid-column: 1 / -1;
grid-row: 5 / 7;
}
.footer {
grid-column: 1 / -1;
}
/* Styling */
.container > div {
display: grid;
justify-content: center;
align-items: center;
font-size: 2em;
color: #ffeead;
}
html, body {
background-color: #ffeead;
box-sizing: border-box;
height: 100%;
margin: 0px;
font-family: "Work Sans"
}
.container > div:nth-child(1n) {
background-color: #96ceb4;
}
.container > div:nth-child(3n) {
background-color: #88d8b0;
}
.container > div:nth-child(2n) {
background-color: #ff6f69;
}
.container > div:nth-child(4n) {
background-color: #ffcc5c;
}
.panels > div:nth-child(1n) {
background-color: #96ceb4;
}
<div class="container">
<div class="header">
HEADER
</div>
<div class="jumbo">
JUMBO
</div>
<div class="panels">
<div class="panel1">PANEL1</div>
<div class="panel2">PANEL2</div>
<div class="panel3">PANEL3</div>
</div>
<div class="content">
CONTENT
</div>
<div class="footer">
FOOTER
</div>
</div>
You have align-items: center applied to the nested grid container (.panels).
With that rule, you override the default align-items: stretch, which would set your grid items to the full height of the parent. Instead, you have the items vertically centered.
So they can be full height, remove align-items: center from the .panels element:
.container > div:not(.panels) {
align-items: center;
}
.container {
display: grid;
width: 100%;
height: 100%;
grid-gap: 3px;
grid-template-columns: repeat(10, 1fr);
grid-template-rows: 40px 130px 130px 130px 60px 330px 40px;
}
.header {
grid-column: 1 / -1;
}
.jumbo {
grid-column: 1 / -1;
grid-row: 2 / 5;
}
.panels {
grid-column: 3 / 9;
grid-row: 4 / 6;
z-index: 1;
display: grid;
grid-template-columns: repeat(3, 1fr);
}
.panel1 {
grid-row: 1 / 2;
grid-row: 1;
background-color: white !important;
z-index: 2;
}
.content {
grid-column: 1 / -1;
grid-row: 5 / 7;
}
.footer {
grid-column: 1 / -1;
}
/* Styling */
.container > div {
display: grid;
justify-content: center;
/* align-items: center; */
font-size: 2em;
color: #ffeead;
}
/* new */
.container > div:not(.panels) {
align-items: center;
}
html, body {
background-color: #ffeead;
box-sizing: border-box;
height: 100%;
margin: 0px;
font-family: "Work Sans"
}
.container > div:nth-child(1n) { background-color: #96ceb4; }
.container > div:nth-child(3n) { background-color: #88d8b0; }
.container > div:nth-child(2n) { background-color: #ff6f69; }
.container > div:nth-child(4n) { background-color: #ffcc5c; }
.panels > div:nth-child(1n) { background-color: #96ceb4; }
<div class="container">
<div class="header">HEADER</div>
<div class="jumbo">JUMBO</div>
<div class="panels">
<div class="panel1">PANEL1</div>
<div class="panel2">PANEL2</div>
<div class="panel3">PANEL3</div>
</div>
<div class="content">CONTENT</div>
<div class="footer">FOOTER</div>
</div>
Then, to vertically center the content of .panels, I would target the content directly:
.panels > div {
display: flex;
align-items: center;
}
.container {
display: grid;
width: 100%;
height: 100%;
grid-gap: 3px;
grid-template-columns: repeat(10, 1fr);
grid-template-rows: 40px 130px 130px 130px 60px 330px 40px;
}
.header {
grid-column: 1 / -1;
}
.jumbo {
grid-column: 1 / -1;
grid-row: 2 / 5;
}
.panels {
grid-column: 3 / 9;
grid-row: 4 / 6;
z-index: 1;
display: grid;
grid-template-columns: repeat(3, 1fr);
}
.panel1 {
grid-row: 1 / 2;
grid-row: 1;
background-color: white !important;
z-index: 2;
}
.content {
grid-column: 1 / -1;
grid-row: 5 / 7;
}
.footer {
grid-column: 1 / -1;
}
/* Styling */
.container > div {
display: grid;
justify-content: center;
/* align-items: center; */
font-size: 2em;
color: #ffeead;
}
/* new */
.container > div:not(.panels) {
align-items: center;
}
/* new */
.panels > div {
display: flex;
align-items: center;
}
html, body {
background-color: #ffeead;
box-sizing: border-box;
height: 100%;
margin: 0px;
font-family: "Work Sans"
}
.container > div:nth-child(1n) { background-color: #96ceb4; }
.container > div:nth-child(3n) { background-color: #88d8b0; }
.container > div:nth-child(2n) { background-color: #ff6f69; }
.container > div:nth-child(4n) { background-color: #ffcc5c; }
.panels > div:nth-child(1n) { background-color: #96ceb4; }
<div class="container">
<div class="header">HEADER</div>
<div class="jumbo">JUMBO</div>
<div class="panels">
<div class="panel1">PANEL1</div>
<div class="panel2">PANEL2</div>
<div class="panel3">PANEL3</div>
</div>
<div class="content">CONTENT</div>
<div class="footer">FOOTER</div>
</div>
Keep in mind that there are three structural levels in a grid container:
the container
the item (child of the container)
the content (child of the item)
Grid properties only work between parent and child.
So when you apply grid centering properties on the container, they apply to the item, not the content. To center the content, you need to treat the item as parent and content as child.
There's a more in-depth explanation of these concepts and methods here: Centering in CSS Grid
Well, what you have done is, you created three columns inside the 'panels' div:
grid-template-columns: repeat(3, 1fr);
But you gave the children only a position for the row (twice):
grid-row: 1 / 2;
grid-row: 1;
So if you change 'columns' to 'rows' in '.panels' and clean up the code for '.panel1' it should work like a cham!
Thank you all for your suggestions. I solved the issue by removing the nested 'panel' and simply creating three different panels to fill the same space.
.container {
display: grid;
width: 100%;
height: 100%;
grid-gap: 3px;
grid-template-columns: repeat(13, 1fr);
grid-template-rows: 50px 218px 218px 200px 80px 530px 40px;
}
.header {
grid-column: 1 / -1;
position: sticky;
top: 0;
z-index: 3;
}
.jumbo {
grid-column: 1 / -1;
grid-row: 2 / 5;
}
.panel1 {
background-color: white !important;
z-index: 1;
grid-column: 3 / 6;
grid-row: 4 / 6;
}
.panel2 {
background-color: black !important;
z-index: 1;
grid-column: 6 / 9;
grid-row: 4 / 6;
}
.panel3 {
background-color: purple !important;
z-index: 2;
grid-column: 9 / 12;
grid-row: 4 / 6;
}
.content-left {
grid-column: 1 / 5;
grid-row: 5 / 7;
}
.content-right {
grid-column: 5 / -1;
grid-row: 5 / 7;
display: grid;
grid-gap: 5px;
align-items: start;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(2, 1fr)
}
.content-right > div {
background-color: white;
z-index: 2;
}
.footer {
grid-column: 1 / -1;
}
.container > div {
justify-content: center;
align-items: center;
font-size: 2em;
color: #ffeead;
}
html, body {
background-color: #ffeead;
box-sizing: border-box;
height: 100%;
margin: 0px;
font-family: "Work Sans"
}
.container > div:nth-child(1n) {
background-color: #96ceb4;
}
.container > div:nth-child(3n) {
background-color: #88d8b0;
}
.container > div:nth-child(2n) {
background-color: #ff6f69;
}
.container > div:nth-child(4n) {
background-color: #ffcc5c;
}
.panels > div:nth-child(1n) {
background-color: #96ceb4;
}
<div class="container">
<div class="header">
HEADER
</div>
<div class="jumbo">
JUMBO
</div>
<div class="panel1">PANEL1</div>
<div class="panel2">PANEL2</div>
<div class="panel3">PANEL3</div>
<div class="content-left">
CONTENT-LEFT
</div>
<div class="content-right">
<div class="content-right1">1</div>
<div class="content-right2">2</div>
<div class="content-right3">3</div>
<div class="content-right4">4</div>
<div class="content-right5">5</div>
<div class="content-right6">6</div>
</div>
<div class="footer">
FOOTER
</div>
</div>