https://idea-hack.com/recipe/bootstrap-4-%e3%83%a2%e3%83%bc%e3%83%80%e3%83%ab%e3%82%b5%e3%83%b3%e3%83%97%e3%83%ab-03/

Bootstrap 4 モーダルサンプル 03

Bootstrap 4 モーダルサンプル 03

DEMO

RECIPE

HTML
<div class="container d-flex justify-content-center mt-100">
    <div class="row">
        <div class="col-md-6"> <button type="button" class="modal-button" data-toggle="modal" data-target="#myModal">Open Modal</button> </div>
    </div>
</div>
<div class="modal fade" id="myModal" role="dialog">
    <div class="modal-dialog">
        <div class="card">
            <div class="card-img"> <img class="img-fluid" src="https://i.imgur.com/4niebFr.jpg"> </div>
            <div class="card-title">
                <p>Success!</p>
            </div>
            <div class="card-text">
                <p>Yay! It's a nice order! <br>It will arrive soon.</p>
            </div> <button class="btn">Track delivery</button>
        </div>
    </div>
</div>
CSS
@import url(https://fonts.googleapis.com/css?family=Calibri:400,300,700);

body {
    background: linear-gradient(to bottom, rgba(46, 46, 172, 0.63), rgba(151, 44, 201, 0.589));
    height: 100vh;
    vertical-align: middle;
    display: flex;
    font-family: 'Calibri', sans-serif !important
}

.mt-100 {
    margin-top: 100px
}

.modal-button {
    background-color: rgb(29, 226, 226);
    border-color: rgb(29, 226, 226);
    border-radius: 6px;
    color: white;
    font-size: 17px;
    padding-right: 76px;
    padding-left: 76px
}

.card {
    border-radius: 3vh;
    margin: auto;
    max-width: 380px;
    padding: 7vh 6vh;
    align-items: center;
    box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.19)
}

@media(max-width:767px) {
    .card {
        width: 90vw
    }
}

.card-img {
    padding: 20px 0;
    width: 40%
}

.card-img img {
    opacity: 0.7
}

.card-title {
    margin-bottom: unset
}

.card-title p {
    color: rgb(29, 226, 226);
    font-weight: 900;
    font-size: 30px;
    margin-bottom: unset
}

.card-text p {
    color: grey;
    font-size: 25px;
    text-align: center;
    padding: 3vh 0;
    font-weight: lighter
}

.btn {
    width: 100%;
    background-color: rgb(29, 226, 226);
    border-color: rgb(29, 226, 226);
    border-radius: 25px;
    color: white;
    font-size: 20px
}

.btn:focus {
    box-shadow: none;
    outline: none;
    box-shadow: none;
    color: white;
    -webkit-box-shadow: none;
    -webkit-user-select: none;
    transition: none
}

.btn:hover {
    color: white
}
Source
  • https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css
  • https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js
  • https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js