@use "sass:math"; .tech-mosaic { display: flex; flex-wrap: wrap; .item { position: relative; box-sizing: border-box; background-color: rgba(231, 231, 231, 0.425); flex-basis: percentage(math.div(1, 8)); } .item::before { content: ''; display: block; padding-top: 100%; } .item .item-inside { position: absolute; top: 0; left: 0; height: 100%; width: 100%; } .item-bg { width: 100%; height: 100%; position: absolute; top: 0; left: 0; display: flex; justify-content: center; align-items: center; overflow: hidden; img { width: 100%; } } .item-bg img.img-stretch { width: auto; height: 100%; } .item-content { position: absolute; top: 0; left: 0; width: 100%; height: 100%; color: white; display: flex; justify-content: center; align-items: center; opacity: 1; background-color: rgba(95, 196, 99, 0.46); transition: all 0.2s; } .item-content > div { opacity: 0; font-size: 1.1em; text-align: center; padding: .5em; line-height: 1.5em; max-width: 100%; } .item:hover .item-content { background-color: rgba(0, 0, 0, 0); } } @media (max-width: 1300px) { .tech-mosaic { .item { flex-basis: percentage(math.div(1, 5)); } } } @media (max-width: 900px) { .tech-mosaic { .item { flex-basis: percentage(math.div(1, 3)); } } } @media (max-width: 500px) { .tech-mosaic { .item { flex-basis: percentage(math.div(1, 2)); } } }