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="area01">
    <div class="inner">
        <div class="qa_box">
        	<div class="qa_q">
        		<p class="q_txt">焼きそばは、何口食べていいですか?</p>
            	<div class="toggle_icon"></div>
            </div>
            <div class="qa_a">
              	<p class="a_txt">4口です。</p>
            </div>
        </div>
        <div class="qa_box">
            <div class="qa_q">
              <p class="q_txt">照り焼きチキンの取り置きはできますか?</p>
            <div class="toggle_icon"></div>
          </div>
            <div class="qa_a">
          <p class="a_txt">申し訳ございません。当店では、取り置き可能な商品は、ピスタチオのみとなっております。</p>
          </div>
        </div>
        <div class="qa_box">
            <div class="qa_q">
              <p class="q_txt">プリンはございますか?</p>
              <div class="toggle_icon"></div>
            </div>
            <div class="qa_a">
              <p class="a_txt">ございます。当店では、マルチビタミンプリン、ベリーピスタチオプリン、暗黒プリンの3種類を販売しています。<br>各プリンの個数は毎日10個限定の為、お早めにご来店ください。</p></div>
        </div>
        <div class="qa_box">
            <div class="qa_q">
              <p class="q_txt">タイムセールはありますか?</p>
              <div class="toggle_icon"></div>
              </div>
            <div class="qa_a">
              <p class="a_txt">不定期ですがございます。いつ頃かは明言できませんが、今までの傾向だと店長が奥さんとケンカした日は、16時~17時頃に突然、「仲直りしたいからタイムセールする!」と言い出します。</p>
            </div>
        </div>
    </div>
</div>
              
            
!

CSS

              
                .area01{
    background-color: #fff;
}

.inner {
	width:750px;
	margin: 20px auto;
}

.qa_box{
    margin-bottom: 20px;
}

.qa_box .qa_q {
    background-color: #014897;
    border: 1px solid #014897;
    padding: 20px 25px;
    position: relative;
    cursor: pointer;
    color: #fff;
}

.toggle_icon {
  position: absolute;
  top: 50%;
  right: 2rem;
  width: 20px;
  height: 20px;
  margin-top: -15px;
}
.toggle_icon:before{
  position: absolute;
  content: "▼";
  margin: auto;
  box-sizing: border-box;
  vertical-align: middle;
}

.qa_q.open .toggle_icon:before{
    position: absolute;
    content: "ー";
    margin: auto;
    box-sizing: border-box;
    vertical-align: middle;
}

.qa_box .qa_a {
    display: none;
    padding: 25px 30px;
    border-left: 1px solid #ccc;
    border-right: 1px solid #ccc;
    border-bottom: 1px solid #ccc;
    box-sizing: border-box;
    background: #fff;
}

.q_txt{
    display: block;
    padding-left: 35px;
    position: relative;
    line-height: 1.5;
    font-size: 20px;
}

.q_txt::before {
    position: absolute;
    left: 0;
    content: "Q.";
    color: #fff;
    font-size: 20px;
    font-weight: bold;
}

.a_txt {
    display: block;
    padding-left: 35px;
    position: relative;
    line-height: 1.5;
}

.a_txt::before {
    position: absolute;
    left: 0;
    content: "A.";
    color: #de0000;
    font-size: 20px;
    font-weight: bold;
}

@media screen and (max-width: 750px) { 
    .inner{
        width: auto;
    }
    
    .toggle_icon {
        right: 0.8rem;
    }
    
    .toggle_icon:before {
        width: 15px;
    }
    .toggle_icon:after {
        height: 15px;
        right: 7px;
    }
}

@media screen and (max-width: 480px) { 
    .toggle_icon {
        right: 0.4rem;
    }
}
              
            
!

JS

              
                $(function(){
    $('.qa_q').click(function(){
        $(this).next().slideToggle();
        $(this).toggleClass("open");
  });
});
              
            
!
999px

Console