Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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">
  <div class="grid-box">
    <div id="content">1</div>
    <div id="sidebar">2</div>
    <div id="content2">3</div>
    <div id="sidebar2">4</div>
    <div id="content3">5</div>
    <div id="sidebar3">6</div>
    <div>7</div>
    <div>8</div>
    <div>9</div>
    <div>10</div>
  </div>
</div>
              
            
!

CSS

              
                .grid-box {
  display: grid; 
  grid-template-columns: repeat(4, 1fr); /*網格區塊的寬度大小*/
  grid-column-gap: 10px; /*網格區塊的左右間距*/
  grid-row-gap: 10px; /*網格區塊的上下間距*/
  grid-template-areas:
  "content content content sidebar"; /*網格區塊名稱*/
}
#content{
  grid-area: content; /*指定網格區塊名稱*/
  background:#ccaaff;
}
#sidebar{
  grid-area: sidebar;
  background:#cceeaa;
}
#content2{
  grid-column: 1/2; /*從第一條線到第二條線,因此只選擇了一個區塊範圍*/
  background:#ccaaff;
}
#sidebar2{
  grid-column: 2/5;
  background:#cceeaa;
}
#content3{
  grid-column: span 3; /*包含區塊的數量*/
  background:#ccaaff;
}
#sidebar3{
  grid-column: span 1;
  background:#cceeaa;
}
.grid-box>div{
  background:#eee;
}
              
            
!

JS

              
                
              
            
!
999px

Console