Skip to content

Instantly share code, notes, and snippets.

@francoisgeorgy
Created May 2, 2020 07:12
Show Gist options
  • Select an option

  • Save francoisgeorgy/85783d22b1bb780bc893cd3f1631307f to your computer and use it in GitHub Desktop.

Select an option

Save francoisgeorgy/85783d22b1bb780bc893cd3f1631307f to your computer and use it in GitHub Desktop.
responsive #css #gridgrid layout
/*
AUTO GRID
Set the minimum item size with `--auto-grid-min-size` and you'll
get a fully responsive grid with no media queries.
*/
.auto-grid > * {
max-width: 25rem;
margin-left: auto;
margin-right: auto;
}
.auto-grid > * + * {
margin-top: 1rem;
}
@supports(display: grid) {
.auto-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(var(--auto-grid-min-size, 16rem), 1fr));
grid-gap: 1rem;
}
.auto-grid > * {
max-width: unset;
margin: unset;
}
}
/*
WRAPPER
A utility with a max width that contains child elements and horizontal centers them
*/
.wrapper {
max-width: 55rem;
margin: 0 auto;
padding: 0 1rem;
}
/* Presentational styles */
body {
background: #efefef;
padding: 1rem;
line-height: 1.4;
font-family: Georgia, serif;
font-size: 1.5rem;
}
li span {
display: block;
padding: 5rem 1rem;
text-align: center;
background: hsl(338,81%,41%);
color: #ffffff;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment