Pen Settings



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


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


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.


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.


                <div class="js-accordion">
  <div class="btn js-btn-more">もっと見る</div>
  <div class="btn js-btn-close">閉じる</div>


                body {
  margin-bottom: 100px;
  margin-top: 20px;
  text-align: center;
li {
  font-size: 18px;
  line-height: 1.5;
.btn {
  border: 1px solid #333;
  cursor: pointer;
  display: inline-block;
  font-size: 18px;
  margin-top: 10px;
  padding: 10px;


                $(function () {
  // liの数を取得
  const listItems = $(".js-accordion li").length;
  $(".js-accordion").each(function () {
    // 最初に表示させるliの数
    let num = 5,
      // 閉じた時に表示させるliの数
      closeNum = num - 1;
    // 最初はもっと見るボタン表示、閉じるボタン非表示
    // 5行目まで表示
      .find("li:not(:lt(" + num + "))")
    // もっと見るボタンがクリックされた時
    $(".js-btn-more").click(function () {
      // numに+5ずつしていく = 5行ずつ追加する
      num += 5;
        .find("li:lt(" + num + ")")
      // liの数よりnumが多い時、
      if (listItems <= num) {
        // もっと見るボタン非表示
        // 閉じるボタン表示
        // 閉じるボタンがクリックされたら、
        $(".js-btn-close").click(function () {
            .find("li:gt(" + closeNum + ")")
            // 6行目以降は非表示
          // 閉じるボタンを非表示
          // もっと見るボタン表示に