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

              
                <section class="mt_S">
			<h2 class="h_2">アコーディオンメニュー</h2>
			<div class="accordion accordion_qa">
				<input type="checkbox" id="check5" class="accordion-hidden">
				<label for="check5" class="accordion-open">
						<span class="Q">質問1</span>
				</label>
				<label for="check5" class="accordion-inner">
					回答が入ります
				</label>
				
				<input type="checkbox" id="check6" class="accordion-hidden">
				<label for="check6" class="accordion-open"><span class="Q">質問2</span></label>
				<label for="check6" class="accordion-inner">
					回答が入ります
				</label>
				
				<input type="checkbox" id="check7" class="accordion-hidden">
				<label for="check7" class="accordion-open"><span class="Q">遠方でも対応してもらえますか?</span></label>
				<label for="check7" class="accordion-inner">
					りんご
				</label>
				
			</div>
</section>
<!-- /Q&Aがついたアコーディオン -->
              
            
!

CSS

              
                body {
    margin: 0;
}

section {
    width: 80%;
    margin: 0 auto;
}

/*ここから*/
.accordion {
  width: 100%;
}
  
/* inputのチェックボックスを非表示 */
.accordion-hidden {
  display: none;
}
  
/* 見出しボタン部分 */
.accordion-open {
  display: flex;
  align-items: center;
  padding: 10px 80px 10px 10px;
  cursor: pointer;
  margin: 5px 0;
  position: relative;
  min-height: 5rem;
}
  
/* +アイコン */
.accordion-open::before,
.accordion-open::after {
  content: '';
  width: 20px;
  height: 2px;
  background: #CBD100;
  position: absolute;
  top: 50%;
  right: 5%;
  transform: translateY(-50%);
}
  
/* アイコンのー */
.accordion-open::after {
  transform: translateY(-50%)
    rotate(90deg);
  transition: .5s;
}
  
/* アコーディオンが開いたらーに */
.accordion-hidden:checked+.accordion-open:after {
  transform: translateY(-50%) rotate(0);
}
  
/* アコーディオン中身部分 */
.accordion-inner {
  display: block;
  height: 0;
  overflow: hidden;
  padding: 0;
  opacity: 0;
  transition: 0.5s;
  /* 表示速度の設定 */
  cursor: pointer;
}

/* チェックボックスにチェックが入ったら中身部分を表示する */
.accordion-hidden:checked+.accordion-open+.accordion-inner {
  height: auto;
  opacity: 1;
  padding: 10px;
}
/* ↑ここまで共通 */
  
  
/* Q&A追加 */
.accordion_qa .Q {
  position: relative;
}
  
.accordion_qa .Q::before {
  content: 'Q.';
  font-size: 1.6em;
  color: #CBD100;
}
  
.accordion_qa .accordion-open {
  padding-left: 2.5em;
}
  
.accordion_qa .accordion-hidden:checked+.accordion-open+.accordion-inner {
  height: auto;
  opacity: 1;
  padding: 10px 10px 10px 4.5em;
}
/* Q&A追加ここまで */
              
            
!

JS

              
                
              
            
!
999px

Console