@media all and (min-width: 960px) { #gallery_layout { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); } } @media all and (max-width: 959px) { #gallery_layout { width: 100%; } .gallery_content { width: 50%; } } @media all and (max-width: 499px) { #gallery_layout { width: 100%; } .gallery_content { width: 100%; } }