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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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="component" id="demo">
  <div class="carousel slide" id="carousel-demo" data-ride="carousel">
    <div class="carousel-inner">
      <div class="carousel-item active">
        <img src="https://www.102like.com/manage/0/product/30802/1516761523_922.jpg" alt="" class="d-block w-100">
      </div>
      <div class="carousel-item">
        <img src="https://img1.how01.com/imgs/bb/8c/4/1b7f0006b47ee1eec676.jpg" alt="" class="d-block w-100">
      </div>
      <div class="carousel-item">
        <img src="https://img.ruten.com.tw/s2/d/27/36/21813814532918_258.jpg" alt="" class="d-block w-100">
      </div>
    </div>
    <a href="#carousel-demo" class="carousel-control-prev" data-slide="prev">
      <span class="carousel-control-prev-icon"></span>
    </a>
    <a href="#carousel-demo" class="carousel-control-next" data-slide="next">
      <span class="carousel-control-next-icon"></span>
    </a>
    <ol class="carousel-indicators">
      <li data-target="#carousel-demo" data-slide-to="0" class="active"></li>
      <li data-target="#carousel-demo" data-slide-to="1"></li>
      <li data-target="#carousel-demo" data-slide-to="2"></li>
    </ol>
  </div>
</div>

<!-- 控制項部分的結構需要在.carousel-inner同層添加a連結 -->
<!-- a連結的屬性有.carousel-control-next與data-slider="prev" -->
<!-- 上面部分為prev,另外一部分的next將上面結構複製一份並且將prev全部改成next -->
<!-- 如要控制項能控制的話,需在.carousel加入#carousel-demo -->
<!-- 在a連結屬性的href加入#carousel-demo,如此按控制項就可有滑動效果 -->

<!-- 指示器也一樣跟.carousel-inner同層需添加ol.carousel-indicators -->
<!-- ol的子元素li的屬性有data-target="carousel-demo"以及data-slider-to="0" -->
<!-- 圖片有幾個就添加幾個,但data-slider-to="0"需要改。是一個順序如第一個就0第二個就1 -->
<!-- 會從0開始可能是使用陣列的方式 -->
<!-- 記得在li第一個加入.active顯示哪個圖片 -->
              
            
!

CSS

              
                #demo.component{
  padding: 50px;
}
#demo .carousel-item{
  height: 500px;
}
#demo .carousel-item img{
  min-height: 500px;
  max-height: 600px;
  object-fit: cover;
}

/* #demo .carousel-item img的尺寸不可低於#demo .carousel-item的尺寸,如低於的話會看不到指示器而破版*/

/* 保持原有的圖片比例的話可以加入object-fit: cover; */
              
            
!

JS

              
                
              
            
!
999px

Console