Skip to content

Instantly share code, notes, and snippets.

@lbarqueira
Created December 2, 2020 23:33
Show Gist options
  • Save lbarqueira/b557d27129b78b2380e94f9fd3d21807 to your computer and use it in GitHub Desktop.
Save lbarqueira/b557d27129b78b2380e94f9fd3d21807 to your computer and use it in GitHub Desktop.
css-grid-example
<div class="gallery">
<img src="http://placeimg.com/640/480/animals">
<img src="http://placeimg.com/640/480/arch">
<img src="http://placeimg.com/640/480/nature">
<img src="http://placeimg.com/640/480/people">
<img src="http://placeimg.com/640/480/tech">
</div>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
.gallery{
display:grid;
grid-template-columns: repeat(auto-fit,minmax(300px, 1fr));
grid-column-gap: 20px;
grid-row-gap: 20px;
}
.gallery img{
width: 100%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment