.modal-dialog {
    width: 500px;
    margin: 30px auto;
    height: 800px;
}

.modal-content {
    width: 310px;
    height: auto;
    left: 96px;
}

#myModal.modal-body {
    max-width: 300px;
    height: auto;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    margin: 5px;
}
#myModal.modal-body .box {
    position: relative;
    width: calc(249px/3);
    height: calc(249px/3);
    float: left;
    box-sizing: border-box;
    display: inline-block;
}
#myModal.modal-body .box .imgBox {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 1;
    transition: transform .2s;
}

#myModal img {
    position: absolute;
    max-width: 100%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: 0.5s;
}
#myModal.modal-body .box .content {
    position: absolute;
    top: 30px;
    text-align: center;
    box-sizing: border-box;
}
#myModal h5 {
    font-size: 5px;
    opacity: 0;
    transition: transform .2s;
}
#myModal-header h5 {
    font-size: 16px;
}
@media all and (max-width: 465px) {
    /* For mobile phones: */
    .modal-content {
        width: 265px;
        padding: 2px;
        left: 43px;
    }

    #myModal.modal-body {
        max-width: 252px;
        height: auto;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 0;
    }
    #myModal.modal-body .box {
        position: relative;
        margin: 0;
        padding: 0;
        width: calc(249px/3);
        height: calc(249px/3);
        float: left;
        box-sizing: border-box;
        display: inline-block;
    }
    #myModal.modal-body .box .imgBox {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        opacity: 1;
        transition: transform .2s;
    }

    #myModal img {
        position: absolute;
        max-width: 100%;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        transition: 0.5s;
    }
    #myModal-header h5 {
        font-size: 15px;
    }
}
