div#itemwrapper { overflow: hidden; background-color: rgba(0, 0, 0, 0.4); z-index: 999; } div#i_items { width: 300%; height: 100%; overflow: hidden; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: 1fr; grid-template-areas: ". . ."; } div.i_item { overflow: hidden; height: 100%; width: 100%; display: flex; align-items: center; justify-content: center; } .item { max-height: 100%; max-width: 100%; } .item:hover { background-color: rgba(0, 0, 0, 0.8); }