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

              
                
<!DOCTYPE html>
<html lang="ja">
<head>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="main.css">
  <title>トグルサンプルサイト</title>

</head>

<body>

 <h2 class="title"> 
  CONTACT
</h2>

<div class="faq">

  <h3>サービスに関するご質問</h3>
  <div class="q1">
   <div class="q1-wrap"><strong class="Q">Q</strong>質問</div>
   <div class="push">▼</div> 
 </div>
 <div class="a1">
   <div class="answer">
    A
  </div>
  <div class="answer-text">
   サンプルアンサー サンプルアンサー サンプルアンサー<br>
   サンプルアンサー<br>
   サンプルアンサー<br>
   サンプルアンサー<br>
   <p>詳しくは担当者○○までお問い合わせください。</p> 
 </div> 
</div>
<div class="q2">
 <div class="q2-wrap"><strong class="Q">Q</strong>質問</div>
 <div class="push">▼</div>             
</div>
<div class="a2">
  <div class="answer">
    A
  </div>
  <div class="answer-text">
   サンプルアンサー サンプルアンサー サンプルアンサー<br>
   サンプルアンサー<br>
   サンプルアンサー<br>
   サンプルアンサー<br>
   <p>詳しくは担当者〇〇までお問い合わせください。</p> 
 </div> 

</div>

</div>   
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>   
<script src="main.js"></script>

</body>

</html>
              
            
!

CSS

              
                 
 html{
      font-family: Helvetica, '游ゴシック', YuGothic, 'ヒラギノ角ゴ Pro W3', 'Hiragino Kaku Gothic Pro', 'メイリオ', Meiryo, sans-serif;
      font-size: 15px;
    }

    .title{
      font-family: 'Pathway Gothic One', sans-serif;
      text-align: center;
      font-weight: bold;
      font-size: 2rem;
    }

    .faq{
      margin:0 auto;
      width:70%;
    }

    .a1{
      display: flex;
      white-space: nowrap;
      overflow-x:scroll;
    }

    .a2{
      display: flex;
      white-space: nowrap;
      overflow-x:scroll;
    }

    .answer{
      color: red;
      font-weight: bold;
    }

    .q1{
      background-color: whitesmoke;
      border-bottom: 1px solid lightgrey;
      padding:14px 0;
      display: flex;
    }

    .q2{
      background-color: whitesmoke;
      border-bottom: 1px solid lightgrey;
      padding:14px 0;
      display: flex;
    }

    .push{
      margin-right: 16px;
      margin-left: auto;
    }

    .Q{
      font-size: 1.5rem;
      margin: 12px;
    }

    .answer-text{
      margin:35px;
    }

    .answer{
      margin-top: 63px;
      font-size: 1.5rem;
    }

              
            
!

JS

              
                
 $(".a1,.a2").hide();

 $(".q1").click(function() {
   $(".a1").toggle("fast");
 })

 $(".q2").click(function() {
   $(".a2").toggle("fast");
 })


              
            
!
999px

Console