Skip to content

Commit

Permalink
Merge pull request #12 from joshuafbarker/grid-gallery-02
Browse files Browse the repository at this point in the history
Image Gallery 2 using CSS Grid
  • Loading branch information
Neha authored Oct 9, 2019
2 parents c47c043 + 6194681 commit ee1da6e
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 0 deletions.
46 changes: 46 additions & 0 deletions galleries/02/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<!DOCTYPE html>
<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">
<title>Responsive Image Gallery</title>
<link rel="stylesheet" href="./style.css">
</head>
<body>
<header>
<h1>Responsive Image Gallery using CSS Grid</h1>
</header>
<main>
<ul class="gallery">
<li class="gallery--item" style="background-image: url('https://source.unsplash.com/random/800x600');">
<div class="gallery--item__content">
<h2 class="gallery--item__title">Title</h2>
<p class="gallery--item__caption">Lorem ipsum dolor sit, amet consectetur adipisicing elit. Culpa ullam rem eveniet, repudiandae magnam ipsa.</p>
</div>
</li>
<li class="gallery--item" style="background-image: url('https://source.unsplash.com/random/800x600');">
<div class="gallery--item__content">
<h2 class="gallery--item__title">Title</h2>
<p class="gallery--item__caption">Lorem ipsum dolor sit, amet consectetur adipisicing elit. Culpa ullam rem eveniet, repudiandae magnam ipsa.</p>
</div>
</li>
<li class="gallery--item" style="background-image: url('https://source.unsplash.com/random/800x600');">
<div class="gallery--item__content">
<h2 class="gallery--item__title">Title</h2>
<p class="gallery--item__caption">Lorem ipsum dolor sit, amet consectetur adipisicing elit. Culpa ullam rem eveniet, repudiandae magnam ipsa.</p>
</div>
</li>
<li class="gallery--item" style="background-image: url('https://source.unsplash.com/random/800x600');">
<div class="gallery--item__content">
<h2 class="gallery--item__title">Title</h2>
<p class="gallery--item__caption">Lorem ipsum dolor sit, amet consectetur adipisicing elit. Culpa ullam rem eveniet, repudiandae magnam ipsa.</p>
</div>
</li>
</ul>
</main>
<footer>
<p>Resize broswer to see the gallery respond.</p>
</footer>
</body>
</html>
55 changes: 55 additions & 0 deletions galleries/02/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/* simple global reset */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

/* some document wide defaults */
html {
font-family: sans-serif;
color: #232425;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
font-kerning: normal;
}

/* ===== HEADER ====== */
header {
padding: 1rem;
background-color: #f3f4f5;
}

/* ===== MAIN ===== */
main {
padding: 1rem;
}

/* ===== FOOTER ===== */
footer {
padding: 1rem;
}

/* ===== GALLERY ===== */
.gallery {
list-style: none;
display: grid;
grid-gap: .5rem;
grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
}

.gallery--item {
min-height: 12rem;
background-position: center;
background-size: cover;
background-repeat: no-repeat;
display: flex;
flex-direction: column;
justify-content: flex-end;
}

.gallery--item__content {
padding: 1rem;
background-image: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,.75));
color: #f3f4f5;
}

0 comments on commit ee1da6e

Please sign in to comment.