/* Grid */ ul.grid > li { background-size: cover; width: calc(25% - 0.2em); padding: 0; padding-bottom: 25%; float: left; position: relative; background-repeat: no-repeat; background-position: center center; box-sizing: border-box; margin: 0.1em; } ul.grid > li > nav { position: absolute; bottom: 0; color: white; background-color: rgba(0, 0, 0, 0.5); width: 100%; padding: 0 2rem; box-sizing: border-box; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; } @media screen and (max-width: 1024px) { ul.grid > li { width: calc(33.33% - 0.2em); padding-bottom: 33.33%; } } @media screen and (max-width: 640px) { ul.grid > li { width: calc(50% - 0.2em); padding-bottom: 50%; } } ul.grid:after { content: ""; display: block; clear: both; } ul.grid.padded { padding: 0; }