.gallery-container { display: flex; flex-wrap: wrap; gap: 10px; } .gallery-item { flex: 1 1 calc(33.333% - 10px); box-sizing: border-box; cursor: pointer; } .gallery-item img { width: 100%; height: auto; max-height: 200px; object-fit: cover; } .modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0, 0, 0, 0.8); } .modal-content { margin: 15% auto; display: block; width: 80%; max-width: 700px; } .modal-content img { width: 100%; height: auto; } .close { position: absolute; top: 10px; right: 25px; color: white; font-size: 35px; font-weight: bold; cursor: pointer; } × function openModal(element) { document.getElementById("myModal").style.display = "block"; document.getElementById("modalImage").src = element.src; } function closeModal() { document.getElementById("myModal").style.display = "none"; }