Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="container mt-3">
    <nav>
        <div class="nav nav-tabs mb-4" id="nav-tab" role="tablist">
            <a class="nav-link active" id="nav-home-tab" data-toggle="tab" href="#nav-home" role="tab"
                aria-controls="nav-home" aria-selected="true">Bali<sup>128</sup></a>
            <a class="nav-link" id="nav-profile-tab" data-toggle="tab" href="#nav-profile" role="tab"
                aria-controls="nav-profile" aria-selected="false">Okinawa<sup>67</sup></a>
            <a class="nav-link" id="nav-contact-tab" data-toggle="tab" href="#nav-contact" role="tab"
                aria-controls="nav-contact" aria-selected="false">Taipei<sup>53</sup></a>
        </div>
    </nav>
    <div class="tab-content" id="nav-tabContent">
        <div class="tab-pane fade show active" id="nav-home" role="tabpanel" aria-labelledby="nav-home-tab">
            <!-- Swiper Start-->
            <div class="swiper-container">
                <div class="swiper-wrapper">
                    <div class="swiper-slide">
                        <div class="card">
                            <img src="https://github.com/hexschool/webLayoutTraining1st/blob/master/week8/top1.jpg?raw=true"
                                class="card-img-top img-cover mb-2" alt="...">
                            <div class="card-body">
                                <h5 class="card-title mb-2">Hotel Aqua</h5>
                                <span class="material-icons">star</span>
                                <span class="material-icons">star</span>
                                <span class="material-icons">star</span>
                                <span class="material-icons">star</span>
                                <span class="material-icons">star</span>
                                <p class="card-text">TWD 2,480</p>
                            </div>
                        </div>
                    </div>
                    <div class="swiper-slide">
                        <div class="card">
                            <img src="https://github.com/hexschool/webLayoutTraining1st/blob/master/week8/top2.jpg?raw=truee"
                                class="card-img-top img-cover mb-2" alt="Mr. Kawasaki Inn pic">
                            <div class="card-body">
                                <h5 class="card-title mb-2">Mr. Kawasaki Inn</h5>
                                <span class="material-icons">star</span>
                                <span class="material-icons">star</span>
                                <span class="material-icons">star</span>
                                <span class="material-icons">star</span>
                                <p class="card-text">TWD 3,380</p>
                            </div>
                        </div>
                    </div>
                    <div class="swiper-slide">
                        <div class="card">
                            <img src="https://github.com/hexschool/webLayoutTraining1st/blob/master/week8/top3.jpg?raw=true"
                                class="card-img-top img-cover mb-2" alt="Weekly Paradise pic">
                            <div class="card-body">
                                <h5 class="card-title mb-2">Weekly Paradise</h5>
                                <span class="material-icons">star</span>
                                <span class="material-icons">star</span>
                                <span class="material-icons">star</span>
                                <span class="material-icons">star</span>
                                <p class="card-text">TWD 4,780</p>
                            </div>
                        </div>
                    </div>
                    <div class="swiper-slide">
                        <div class="card">
                            <img src="https://github.com/hexschool/webLayoutTraining1st/blob/master/week8/top4.jpg?raw=true"
                                class="card-img-top img-cover mb-2" alt="Beast Hotel pic">
                            <div class="card-body">
                                <h5 class="card-title mb-2">Beast Hotel</h5>
                                <span class="material-icons">star</span>
                                <span class="material-icons">star</span>
                                <span class="material-icons">star</span>
                                <span class="material-icons">star</span>
                                <p class="card-text">TWD 4,780</p>
                            </div>
                        </div>
                    </div>
                    <div class="swiper-slide">
                        <div class="card">
                            <img src="https://images.unsplash.com/photo-1459535653751-d571815e906b?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1920&q=80"
                                class="card-img-top img-cover mb-2" alt="Hotel ABCuuu pic">
                            <div class="card-body">
                                <h5 class="card-title mb-2">Hotel ABCuuu</h5>
                                <span class="material-icons">star</span>
                                <span class="material-icons">star</span>
                                <span class="material-icons">star</span>
                                <span class="material-icons">star</span>
                                <span class="material-icons">star</span>
                                <p class="card-text">TWD 5,480</p>
                            </div>
                        </div>
                    </div>
                    <div class="swiper-slide">
                        <div class="card">
                            <img src="https://images.unsplash.com/photo-1449844908441-8829872d2607?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1950&q=80"
                                class="card-img-top img-cover mb-2" alt="Special Hotel DEF pic">
                            <div class="card-body">
                                <h5 class="card-title mb-2">Special Hotel DEF</h5>
                                <span class="material-icons">star</span>
                                <span class="material-icons">star</span>
                                <span class="material-icons">star</span>
                                <span class="material-icons">star</span>
                                <span class="material-icons">star</span>
                                <p class="card-text">TWD 7,480</p>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- Add Arrows -->
                <div class="swiper-button-next"></div>
                <div class="swiper-button-prev"></div>
            </div>
            <!-- Swiper End-->
        </div>
        <div class="tab-pane fade" id="nav-profile" role="tabpanel" aria-labelledby="nav-profile-tab">Okinawa</div>
        <div class="tab-pane fade" id="nav-contact" role="tabpanel" aria-labelledby="nav-contact-tab">Taipei</div>
    </div>
</div>
              
            
!

CSS

              
                .img-cover{
    object-fit: cover;
    object-position: center center;
    max-width: 100%;
    height: auto;
}
.card{
    width: 255px;
    border:none;
    &-img-top{
        height: 175px;
        border-radius: 8px;
    }
    &-body{
        padding: 0;
    }
}
.nav-tabs{
    & .nav-link{
        border-width: 2px;
    }
    & .nav-link.active , & .nav-link:hover {
        color: #495057;
        background-color: #fff;
        border-color: transparent transparent #6C51E2 transparent;
        border-width: 2px;
    }
}

.swiper-button-next{
    padding: 25px;
    background: #F1F0F8;
    border-radius: 50%;
    &:after{
        color:#000 ;
        font-size:15px;
        font-weight: 700;
    }
}

.swiper-button-prev{
    display: none;
}
              
            
!

JS

              
                var swiper = new Swiper('.swiper-container', {
      slidesPerView: 4,   //同時顯示的slides數量
      spaceBetween: 30,   //slide之間的距離 (單位px)
      loop: true,
      pagination: {
        el: '.swiper-pagination',  
        clickable: true,  
      },
      navigation: {
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
      },
});
              
            
!
999px

Console