Skip to content

Instantly share code, notes, and snippets.

@dmitry-vsl
Last active April 12, 2018 10:46
Show Gist options
  • Save dmitry-vsl/fe6bc0105c8bfefa8b8bdb2efa544a78 to your computer and use it in GitHub Desktop.
Save dmitry-vsl/fe6bc0105c8bfefa8b8bdb2efa544a78 to your computer and use it in GitHub Desktop.
Grid demo
<style>
body {
position: relative;
display: grid;
height: 100%;
grid-template-areas:
"m h h h "
"m c c c "
"m c c c ";
}
.header {
background-color: green;
grid-area: h;
}
.content {
background-color: red;
height: 100%;
grid-area: c;
}
.menu {
background-color: magenta;
grid-area: m;
}
.test {
position: absolute;
left: 100px;
top: 50px;
width: 5px;
height: 5px;
background-color: blue;
}
</style>
<div class=header> </div>
<div class=content> </div>
<div class=menu> </div>
<div class='test'> </div>
<style>
body {
margin: 0;
position: relative;
display: grid;
height: 100%;
grid-template-areas: "x";
}
body > div {
grid-area: x;
}
.center {
justify-self: center;
align-self: center;
}
.north {
justify-self: center;
}
.south {
align-self: end;
justify-self: center;
}
.west {
align-self: center;
justify-self: start;
}
.north-west {
}
.almost-center {
justify-self: center;
align-self: center;
position: relative;
top: 40px;
}
</style>
<div class=north> north </div>
<div class=south> south </div>
<div class=west> west </div>
<div class=north-west> north-west </div>
<div class=center> center </div>
<div class=almost-center> almost-center </div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment