@media screen and (max-width: 991.98px) { /* Styles for screens wider than 768px (commonly used for laptop/desktop) */ div#myModal { width: 100% !important; height: 80vh !important; max-height: 528px; top: 15%; } } div#myModal { top: 50%; left: 50%; transform: translate(-50%, -50%); }