A Pen by Matthew Daniel Brown on CodePen.
Created
March 6, 2019 04:21
-
-
Save matt-daniel-brown/565737dd20bee3f35a960d681711aeea to your computer and use it in GitHub Desktop.
Simple, Clean, Responsive, Semantic Grid (Gallery) Layout (using CSS Grids and Flexbox Fallback)
This file contains hidden or 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
<main> | |
<section id="gallery-section"> | |
<ul> | |
<li><img src="http://placehold.it/320x240" alt=""></li> | |
<li><img src="http://placehold.it/320x240" alt=""></li> | |
<li><img src="http://placehold.it/320x240" alt=""></li> | |
<li><img src="http://placehold.it/320x240" alt=""></li> | |
<li><img src="http://placehold.it/320x240" alt=""></li> | |
<li><img src="http://placehold.it/320x240" alt=""></li> | |
</ul> | |
</section> | |
</main> |
This file contains hidden or 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
* { | |
box-sizing: border-box; | |
} | |
body { | |
background: ghostwhite; | |
} | |
main { | |
padding: 5vw; | |
} | |
.container { | |
// background-color: #ddd; | |
display: grid; | |
grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); | |
grid-gap: 1em; | |
} | |
img { | |
width: 100%; | |
align-self: center; | |
} | |
section#gallery-section { | |
ul { | |
@extend .container; | |
li { | |
img { | |
border-radius: 8px; | |
box-shadow: 0 8px 32px -8px rgba(gray, 0.5); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment