Created
February 19, 2019 16:43
-
-
Save bmoren/b96274ae3474356f8521bc8ee21546ba to your computer and use it in GitHub Desktop.
a 2D grid example for starting out a grid based project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> | |
<!-- you dont really need this file, its just to show you how to use this grid system! --> | |
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> | |
<!DOCTYPE html> | |
<html lang="en" dir="ltr"> | |
<head> | |
<meta charset="utf-8"> | |
<title></title> | |
<link rel="stylesheet" href="simplegrid.css"> | |
<link rel="stylesheet" href="testing.css"> | |
</head> | |
<body> | |
<div class="grid-parent grid-gap"> | |
<div class="start-c-1 end-c-5 start-r-1 end-r-3"> | |
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. | |
</div> | |
<div class="start-c-5 end-c-13"> | |
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. | |
</div> | |
<div class="start-c-1 end-c-3 start-r-3 end-r-4 plant-cat"> | |
<img src="http://placekitten.com/200/199" alt=""> | |
</div> | |
<div class="start-c-1 end-c-3 start-r-3 end-r-4"> | |
<img src="http://placekitten.com/200/200" alt=""> | |
</div> | |
<div class="start-c-4 end-c-11 start-r-5 end-r-6"> | |
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. | |
</div> | |
<div class="start-c-11 end-c-13 test justify-self-center align-self-center"> | |
hello? | |
</div> | |
</div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* This is the main grid file, this is the one you can use in your own project! */ | |
/* +~+~+~+~+ Defines a 12 column grid on a container of items +~+~+~+~ */ | |
.grid-parent{ | |
display:grid; | |
grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr; | |
grid-template-rows: 1fr 1fr 1fr 1fr 1fr ; | |
} | |
/* +~+~+~+~+~ parent settings +~+~+~+~+~+~+~+~+ */ | |
.justify-items-start{justify-items: start;} | |
.justify-items-end{justify-items: end;} | |
.justify-items-center{justify-items: center;} | |
.justify-items-stretch{justify-items: stretch;} | |
.align-items-start{align-items: start;} | |
.align-items-end{align-items: end;} | |
.align-items-center{align-items: center;} | |
.align-items-stretch{align-items: stretch;} | |
.align-content-start{align-content: start;} | |
.align-content-end{align-content: end;} | |
.align-content-center{align-content: center;} | |
.align-content-stretch{align-content: stretch;} | |
.align-content-space-around{align-content: space-around;} | |
.align-content-space-between{align-content: space-between;} | |
.align-content-space-evenly{align-content: space-evenly;} | |
/* +~+~+~+~+~+~ child grid assignments +~+~+~+~+~+ */ | |
.start-c-1{grid-column-start: 1} | |
.start-c-2{grid-column-start: 2} | |
.start-c-3{grid-column-start: 3} | |
.start-c-4{grid-column-start: 4} | |
.start-c-5{grid-column-start: 5} | |
.start-c-6{grid-column-start: 6} | |
.start-c-7{grid-column-start: 7} | |
.start-c-8{grid-column-start: 8} | |
.start-c-9{grid-column-start: 9} | |
.start-c-10{grid-column-start: 10} | |
.start-c-11{grid-column-start: 11} | |
.start-c-12{grid-column-start: 12} | |
.start-c-13{grid-column-start: 13} | |
.end-c-1{grid-column-end: 1} | |
.end-c-2{grid-column-end: 2} | |
.end-c-3{grid-column-end: 3} | |
.end-c-4{grid-column-end: 4} | |
.end-c-5{grid-column-end: 5} | |
.end-c-6{grid-column-end: 6} | |
.end-c-7{grid-column-end: 7} | |
.end-c-8{grid-column-end: 8} | |
.end-c-9{grid-column-end: 9} | |
.end-c-10{grid-column-end: 10} | |
.end-c-11{grid-column-end: 11} | |
.end-c-12{grid-column-end: 12} | |
.end-c-13{grid-column-end: 13} | |
.start-r-1{grid-row-start: 1} | |
.start-r-2{grid-row-start: 2} | |
.start-r-3{grid-row-start: 3} | |
.start-r-4{grid-row-start: 4} | |
.start-r-5{grid-row-start: 5} | |
.start-r-6{grid-row-start: 6} | |
.end-r-1{grid-row-end: 1} | |
.end-r-2{grid-row-end: 2} | |
.end-r-3{grid-row-end: 3} | |
.end-r-4{grid-row-end: 4} | |
.end-r-5{grid-row-end: 5} | |
.end-r-6{grid-row-end: 6} | |
/* +~+~+~+~ child settings +~+~+~+~+~ */ | |
.align-self-start{align-self: start;} | |
.align-self-end{align-self: end;} | |
.align-self-center{align-self: center;} | |
.align-self-stretch{align-self: stretch;} | |
.justify-self-start{justify-self: start; } | |
.justify-self-end{justify-self: end; } | |
.justify-self-center{justify-self: center; } | |
.justify-self-stretch{justify-self: stretch; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
you dont really need this file, its just to show you how to use this grid system! | |
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
*/ | |
/* testing */ | |
html, body { | |
box-sizing: border-box; | |
margin:0; | |
padding:0; | |
font-size: 26px; | |
font-weight: 400; | |
color:white; | |
} | |
*, *:before, *:after { | |
box-sizing: inherit; | |
} | |
.grid-parent div{ | |
padding: 10px; | |
} | |
.grid-parent div:nth-child(odd){ | |
/* border: 1px solid black; */ | |
background-color: rgb(6, 139, 95); | |
} | |
.grid-parent div:nth-child(even){ | |
/* border: 1px solid black; */ | |
background-color: rgb(150, 50, 57); | |
} | |
.test{ | |
height:100px;width:200px; | |
} | |
/* It doesnt really make sense to set this in the core css file */ | |
.grid-gap{grid-gap: 15px} | |
.plant-cat{ | |
z-index: 1; | |
transform: translate(-20px,-20px); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment