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

              
                h1 Dive into Bootstrap4 Container 
hr
h3.my-4 基本的 container 結構
pre.mb-5
    code.language-html.
        &lt;div class=&quot;container&quot;&gt;
            &lt;div class=&quot;row&quot;&gt;
              &lt;div class=&quot;col&quot;&gt;
                 &lt;h4&gt;div Lorem ipsum dolor sit amet consectetur adipisicing elit. Veniam, minima.&lt;/h4&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
.container
    .row
        .col
            h4 div Lorem ipsum dolor sit amet consectetur adipisicing elit. Veniam, minima.
hr.my-5
h3.my-4 客制化 container 寬度
pre.mb-5
    code.language-html.
        &lt;div class=&quot;container custom-container-width&quot;&gt;
          &lt;div class=&quot;row&quot;&gt;
            &lt;div class=&quot;col&quot;&gt;
              &lt;h4&gt;div Lorem ipsum dolor sit amet consectetur adipisicing elit. Veniam, minima.&lt;/h4&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
pre.mb-5
    code.language-css.
        /* css */
        .container.custom-container-width {
            max-width: 1010px;
        }
.container.custom-container-width
    .row
        .col
            h4 div Lorem ipsum dolor sit amet consectetur adipisicing elit. Veniam, minima.
hr.my-5
h3.my-4 瞭解欄位間距(gutter)
pre.mb-5
    code.language-html.
        &lt;div class=&quot;container&quot;&gt;
          &lt;div class=&quot;row&quot;&gt;
            &lt;div class=&quot;col&quot;&gt;
              &lt;h4&gt;div Lorem ipsum dolor sit amet.&lt;/h4&gt;
            &lt;/div&gt;
            &lt;div class=&quot;col&quot;&gt;
              &lt;h4&gt;div Lorem ipsum dolor sit amet.&lt;/h4&gt;
            &lt;/div&gt;
            &lt;div class=&quot;col&quot;&gt;
              &lt;h4&gt;div Lorem ipsum dolor sit amet.&lt;/h4&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
.container
    .row
        .col
            h4 div Lorem ipsum dolor sit amet.
        .col
            h4 div Lorem ipsum dolor sit amet.
        .col
            h4 div Lorem ipsum dolor sit amet.
hr.my-5
h3.my-4 不要使用間距(.no-gutter)
pre.mb-5
    code.language-html.
        &lt;div class=&quot;container&quot;&gt;
          &lt;div class=&quot;row no-gutters&quot;&gt;
            &lt;div class=&quot;col&quot;&gt;
              &lt;h4&gt;div Lorem ipsum dolor sit amet.&lt;/h4&gt;
            &lt;/div&gt;
            &lt;div class=&quot;col&quot;&gt;
              &lt;h4&gt;div Lorem ipsum dolor sit amet.&lt;/h4&gt;
            &lt;/div&gt;
            &lt;div class=&quot;col&quot;&gt;
              &lt;h4&gt;div Lorem ipsum dolor sit amet.&lt;/h4&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
.container
    .row.no-gutters
        .col
            h4 div Lorem ipsum dolor sit amet.
        .col
            h4 div Lorem ipsum dolor sit amet.
        .col
            h4 div Lorem ipsum dolor sit amet.
hr.my-5
h3.my-4 使用客制化間距(Custom Gutters)
pre.mb-5
    code.language-html.
        &lt;div class=&quot;container custom-gutters&quot;&gt;
          &lt;div class=&quot;row&quot;&gt;
            &lt;div class=&quot;col&quot;&gt;
              &lt;h4&gt;div Lorem ipsum dolor sit amet.&lt;/h4&gt;
            &lt;/div&gt;
            &lt;div class=&quot;col&quot;&gt;
              &lt;h4&gt;div Lorem ipsum dolor sit amet.&lt;/h4&gt;
            &lt;/div&gt;
            &lt;div class=&quot;col&quot;&gt;
              &lt;h4&gt;div Lorem ipsum dolor sit amet.&lt;/h4&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
pre.mb-4
    code.language-scss. 
        /* scss */
        $custom-gutter-width: 20px;
        .custom-gutters {
            &.container {
                padding-left: $custom-gutter-width / 2;
                padding-right: $custom-gutter-width / 2;
            }
            .row {
                margin-left: -($custom-gutter-width / 2);
                margin-right: -($custom-gutter-width / 2);
            }
            .col {
                padding-left: $custom-gutter-width / 2;
                padding-right: $custom-gutter-width / 2;
            }
        }
.container.custom-gutters
    .row
        .col
            h4 div Lorem ipsum dolor sit amet.
        .col
            h4 div Lorem ipsum dolor sit amet.
        .col
            h4 div Lorem ipsum dolor sit amet.
              
            
!

CSS

              
                /**
 * 方便瞭解容器寬度和內容寬度
**/
.container {
    outline: 1px solid #41CEC0;
    background-color: rgba(65, 206, 192, 0.5);
    h4 {
        background-color: rgba(65, 184, 131, 0.5);
        color: #333;
    }
}

.col {
    outline: 1px solid #41CEC0;
}
.custom-container-width {
    max-width: 1010px;
}

$custom-gutter-width: 20px;
.custom-gutters {
    &.container {
        padding-left: $custom-gutter-width / 2;
        padding-right: $custom-gutter-width / 2;
    }
    .row {
        margin-left: -($custom-gutter-width / 2);
        margin-right: -($custom-gutter-width / 2);
    }
    .col {
        padding-left: $custom-gutter-width / 2;
        padding-right: $custom-gutter-width / 2;
    }
}



              
            
!

JS

              
                
              
            
!
999px

Console