Skip to content

Commit

Permalink
added css grid tutorial files
Browse files Browse the repository at this point in the history
  • Loading branch information
FollowAndrew committed Feb 5, 2020
1 parent d09a186 commit 4486315
Show file tree
Hide file tree
Showing 3 changed files with 224 additions and 0 deletions.
11 changes: 11 additions & 0 deletions CSS Grid Web Gallery/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# CSS Grid Responsive Web Gallery
Learn how to create a css grid responsive web gallery from scratch!


## Getting Started

See the video tutorial here: https://youtu.be/47Efc4fvng4

## License

This project is licensed under the MIT License
122 changes: 122 additions & 0 deletions CSS Grid Web Gallery/grid-gallery.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
body{
margin:20px;
padding:0;
text-align:center;
}
.container{
display:grid;
grid-template-columns: repeat(6,1fr);
grid-auto-rows:100px 300px;
grid-gap:10px;
grid-auto-flow: dense;
}

.gallery-item{
width:100%;
height:100%;
position:relative;
}

.gallery-item .image{
width:100%;
height:100%;
overflow:hidden;
}

.gallery-item .image img{
width:100%;
height:100%;
object-fit: cover;
object-position:50% 50%;
cursor:pointer;
transition:.5s ease-in-out;
}
.gallery-item:hover .image img{
transform:scale(1.5);
}

.gallery-item .text{
opacity:0;
position:absolute;
top:50%;
left:50%;
transform:translate(-50%,-50%);
color:#fff;
font-size:25px;
pointer-events:none;
z-index:4;
transition: .3s ease-in-out;
-webkit-backdrop-filter: blur(5px) saturate(1.8);
backdrop-filter: blur(5px) saturate(1.8);
}

.gallery-item:hover .text{
opacity:1;
animation: move-down .3s linear;
padding:1em;
width:100%;
}

.w-1{
grid-column: span 1;
}
.w-2{
grid-column: span 2;
}
.w-3{
grid-column: span 3;
}
.w-4{
grid-column: span 4;
}
.w-5{
grid-column: span 5;
}
.w-6{
grid-column: span 6;
}

.h-1{
grid-row: span 1;
}
.h-2{
grid-row: span 2;
}
.h-3{
grid-row: span 3;
}
.h-4{
grid-row: span 4;
}
.h-5{
grid-row: span 5;
}
.h-6{
grid-row: span 6;
}




@media screen and (max-width:500px){
.container{
grid-template-columns: repeat(1,1fr);
}
.w-1,.w-2,.w-3,.w-4,.w-5,.w-6{
grid-column:span 1;
}
}


@keyframes move-down{

0%{
top:10%;
}
50%{
top:35%;
}
100%{
top:50%;
}
}
91 changes: 91 additions & 0 deletions CSS Grid Web Gallery/grid-gallery.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="grid-gallery.css" media="all">
<title>CSS Grid</title>
</head>

<body>

<h1>CSS Grid Gallery</h1>
<div class="container">

<div class="gallery-container w-3 h-2">
<div class="gallery-item">
<div class="image">
<img src="https://source.unsplash.com/1600x900/?nature" alt="nature">
</div>
<div class="text">Nature</div>
</div>
</div>

<div class="gallery-container w-3 h-3">
<div class="gallery-item">
<div class="image">
<img src="https://source.unsplash.com/1600x900/?people" alt="people">
</div>
<div class="text">People</div>
</div>
</div>

<div class="gallery-container h-2">
<div class="gallery-item">
<div class="image">
<img src="https://source.unsplash.com/1600x900/?sport" alt="sport">
</div>
<div class="text">Sport</div>
</div>
</div>

<div class="gallery-container w-2">
<div class="gallery-item">
<div class="image">
<img src="https://source.unsplash.com/1600x900/?fitness" alt="fitness">
</div>
<div class="text">Fitness</div>
</div>
</div>

<div class="gallery-container w-4 h-1">
<div class="gallery-item">
<div class="image">
<img src="https://source.unsplash.com/1600x900/?food" alt="food">
</div>
<div class="text">Food</div>
</div>
</div>

<div class="gallery-container">
<div class="gallery-item">
<div class="image">
<img src="https://source.unsplash.com/1600x900/?travel" alt="travel">
</div>
<div class="text">Travel</div>
</div>
</div>

<div class="gallery-container h-2">
<div class="gallery-item">
<div class="image">
<img src="https://source.unsplash.com/1600x900/?art" alt="art">
</div>
<div class="text">Art</div>
</div>
</div>

<div class="gallery-container">
<div class="gallery-item">
<div class="image">
<img src="https://source.unsplash.com/1600x900/?cars" alt="cars">
</div>
<div class="text">Cars</div>
</div>
</div>

</div>
</body>

</html>

0 comments on commit 4486315

Please sign in to comment.