$bg-big-image-handler: fade-out($black, 0.3); .oversized-image { cursor: zoom-in; } .oversized-image-zoom { position: fixed; top: 0; right: 0; bottom: 0; left: 0; height: 100%; width: 100%; z-index: 10000; background: $bg-big-image-handler; cursor: zoom-out; display: flex; justify-content: center; align-items: center; // The actual oversized image is loaded as a background image so we can // use the background-size option "contain" which will ensure that the // image will be visible even on small displays. span { background-color: $bg-big-image-handler; background-position: center; background-repeat: no-repeat; background-size: contain; border: 1px solid var(--white); box-shadow: 0 0 20px fade-out($white, 0.5); display: block; max-width: 98%; max-height: 98%; img { opacity: 0; } } }