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

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

              
                <p>(1)grid-template-columns: 400px 1fr;<br>1つ目のboxは400px、2つ目のboxは残りの幅全てを埋める様に配置</p>
<div class="grid1">
  <div class="box">400px固定</div>
  <div class="box">1fr(残りの幅を埋める)</div>
</div><br>
<p>(2)grid-template-columns: repeat(4, 1fr);<br>boxを4列で配置</p>
<div class="grid2">
  <div class="box"></div>
  <div class="box"></div>
  <div class="box"></div>
  <div class="box"></div>
  <div class="box"></div>
  <div class="box"></div>
  <div class="box"></div>
  <div class="box"></div>
  <div class="box"></div>
</div>
              
            
!

CSS

              
                //1つ目のboxは400px、2つ目のboxは残りの幅全てを埋める様に配置
.grid1 {
  display: grid;
  //1つ目、2つ目の要素の幅を順番に指定
  grid-template-columns: 400px 1fr;
  //gapで余白を指定
  gap:0 20px;
}

//boxを4列で配置
.grid2 {
  display: grid;
  //repeatの一つ目の値で何カラムにするかを指定
  grid-template-columns: repeat(4, 1fr);
  //gapで余白を指定
  gap:20px;
}

p {
  margin: 10px 0;
}
.box {
  border: 1px solid #ddd;
  background-color: #efefef;
  height: 100px;
}

              
            
!

JS

              
                
              
            
!
999px

Console