Skip to content

Instantly share code, notes, and snippets.

@karolans25
Created March 21, 2024 03:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karolans25/1f2252a19f8c196fcec8083a1bc9ec65 to your computer and use it in GitHub Desktop.
Save karolans25/1f2252a19f8c196fcec8083a1bc9ec65 to your computer and use it in GitHub Desktop.
<div class="container">
<div class="colLeft">
<div class="item item-1">
<div class="item item-a">1a</div>
<div class="item item-b">1b</div>
</div>
<div class="item item-2">2</div>
</div>
<div class="colRight">
<div class="item item-3">3</div>
<div class="item item-4">4</div>
</div>
</div>
<style>
/* BASE STYLES */
:root {
--clr-dark: #0f172a;
--clr-light: #f1f5f9;
--clr-accent: #e11d48;
}
*,*::before,*::after {
box-sizing: border-box;
}
body {
margin: 0;
padding: 0;
line-height: 1.6;
word-spacing: 1.4px;
font-family: "Roboto", sans-serif;
color: var(--clr-dark);
background-color: var(--clr-light);
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.container {
width: 50%;
height: 650px;
margin: 0 auto;
border: 10px solid var(--clr-dark);
}
.item {
background-color: #fb7185;
display: flex;
justify-content: center;
align-items: center;
border: 1px solid red;
}
/* END OF BASE STYLES */
.container {
display: grid;
grid-template-columns: 1fr 1fr;
}
@media screen and (max-width: 400px) {
.container{
background-color: purple;
grid-template-columns: 1fr 6fr;
}
}
@media screen and (min-width: 400px) and (max-width: 800px) {
.container{
background-color: green;
grid-template-columns: 1fr 4fr;
}
}
@media screen and (min-width: 800px) and (max-width: 1000px) {
.container{
background-color: cyan;
grid-template-columns: 1fr 2fr;
}
}
.colLeft, .colRight {
height: 100%;
border: 5px solid blue;
display: flex;
flex-flow: column nowrap;
justify-content: space-evenly;
align-items: center;
align-content: space-around;
}
.colLeft {
flex-grow: 1;
flex-shrink: 10;
}
.colRight {
flex-grow: 1;
flex-shrink: 1;
}
.item-1 {
flex: 0 1 30%;
width: 95%;
display: flex;
}
.item-a {
height: 100%;
width: 50%;
}
.item-b {
height: 100%;
width: 50%;
}
.item-2 {
flex: 0 1 55%;
width: 95%;
}
.item-3 {
flex: 0 0 55%;
width: 95%;;
}
.item-4 {
flex: 0 0 30%;
width: 95%;
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment