.wrapper { width: 30%; height: 30%; } .overlay { position: absolute; top: 0; bottom: 0; right: 0; left: 0; z-index: 1; display: flex; align-items: center; justify-content: center; background-color: rgba(255, 255, 255, 0.8); }