Skip to content

Instantly share code, notes, and snippets.

@cacaudev
Last active November 5, 2023 21:29
Show Gist options
  • Save cacaudev/26b8e2ee16891a04c656fe27145a250b to your computer and use it in GitHub Desktop.
Save cacaudev/26b8e2ee16891a04c656fe27145a250b to your computer and use it in GitHub Desktop.
Template from page divided full screen by half with flexbox, and responsive width
* {
box-sizing: border-box;
}
body, html {
margin: 0;
padding: 0;
}
.header-font {
color: black;
}
.page-content {
min-height: 100vh;
height: 100%;
max-width: 100%;
position: relative;
align-items: stretch;
}
.flex {
display : flex;
}
.flex-grid-direction {
flex-direction: row;
}
.flex-row {
flex-direction: row;
}
.flex-column {
flex-direction : column;
}
.flex-wrap {
flex-wrap: wrap;
}
.flex-item {
flex: 1;
align-items: center;
justify-content: center;
}
.leftSide {
order: 1 /* order start hack */;
background: #144714;
width: 60%;
}
.rightSide {
order: 2 /* order end hack */ ;
background: aqua;
width: 40%;
}
@media (max-width: 600px) {
.flex-grid-direction {
flex-direction: column;
}
.leftSide {
width: 100%;
}
.rightSide {
width: 100%;
}
}
html:
<head>
<link rel="stylesheet" href="style.css">
</head>
<section class="page-content flex flex-wrap flex-row">
<section class="flex flex-item leftSide">
<h1>hi</h1>
</section>
<section class="flex flex-item rightSide">
<h1>hi2</h1>
</section>
</section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment