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

              
                
<section>
  <h1>
  アコーディオンメニュー レシピの歴史
 </h1>
  <details>
    <summary>1990s JavaScript</summary>
    <p>
      Web黎明期、ユーザーの動きに合わせたアニメーションはJapaScriptで実装されました。
    </p>
  </details>
  <details>
    <summary>2000s jQuery</summary>
    <p>
      OSやブラウザが多様化しコードが複雑になると、どんな環境でも簡単に動くアニメーションライブラリとしてjQueryが普及します。
    </p>
  </details>
  <details>
    <summary>2010s CSS Ainme & input</summary>
    <p>CSS3アニメの流行とともに、JavaScriptアニメはレガシーに。ユーザーアクションのフックにはinputタグを複雑に活用します。</p>
  </details>
  <details>
    <summary>2020s Details & Summry
    </summary>
    <p>簡単!DetailsタグとSummryタグでアコーディオンメニューを作る時代が到来。</p>
  </details>
</section>
              
            
!

CSS

              
                
details[open] summary ~ * {
  animation: open 0.5s ease-in-out;
}
@keyframes open {
  0%   { height: 0; }
  100% { height: 100%; }
}

details[open] p {
  animation: grow 0.8s ease-in-out;
}
@keyframes grow {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}

details summary:after {
  content: "+";
  color: black;
  position: absolute;
  font-size: 1.75rem;
  line-height: 0;
  margin-top: 0.75rem;
  right: 0;
  font-weight: 200;
  transform-origin: center 17%;
  font-size: 2rem;
  display:inline-block;
  height:1rem;
  transition: 800ms linear;
}
details[open] summary:after {
  transform: rotate(945deg);
}

details summary::-webkit-details-marker {
  display: none;
}

details summary {
  width: 100%;
  padding: 0.5rem 0;
  border-top: 1px solid black;
  position: relative;
  cursor: pointer;
  font-size: 1.25rem;
  font-weight: 300;
  list-style: none;
}

details summary {
  outline: 0;
}
details p {
  font-size: 0.95rem;
  margin: 0 0 1rem;
  padding-top: 1rem;
}
html,
.root {
  padding: 0;
  margin: 0;
  font-size: 18px;
}

body {
  font: menu;
  font-size: 1rem;
  line-height: 1.4;
  padding: 0;
  margin: 0;
}
section {
  padding-top: 1em;
  width: 50%;
  margin: auto;
}
h1 {
  font-size: 1.4rem;
  font-weight: 500;
}
              
            
!

JS

              
                
              
            
!
999px

Console