*, *::before, *::after {
    box-sizing: border-box;
}
body {
    margin: 0;
    padding: 0;
}
.demo-gallery {
    width: 100%;
    max-width: 100vw;
    margin: 0 auto;
}
.list-unstyled {
    list-style-type: none;
    display: grid;
    grid-gap: 10px;
    grid-template-columns: repeat(auto-fill, minmax(150px, 300px));
    padding: 10px;
    align-items: center;
    justify-content: center;
}

.list-unstyled li {
    display: flex;
    align-items: stretch;
    max-height: 200px;
    overflow-y: hidden;
}
.list-unstyled li img {
    display: block;
    width: 100%;
    max-width: 300px;
    height: auto;
    object-fit: cover;
}

@media (max-width:768px) {
    .list-unstyled {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        grid-gap: 5px;
        padding: 0;
    }
}