-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from joshuafbarker/grid-gallery-02
Image Gallery 2 using CSS Grid
- Loading branch information
Showing
2 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
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
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> |
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
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; | ||
} |