Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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

              
                <ul class="accordion9">
	<li>
		<p class="ac1 open1">アコーディオン1</p>
		<ul class="inner">
			<li class="content1-1">
				<p>コンテンツ1</p>
				<ul>
					<li>コンテンツ1-1</li>
					<li>コンテンツ1-2</li>
					<li>コンテンツ1-3</li>
				</ul>
			</li>
			<li class="content1-2">
				<p>コンテンツ2</p>
				<ul>
					<li>コンテンツ2-1</li>
					<li>コンテンツ2-2</li>
					<li>コンテンツ2-3</li>
				</ul>
			</li>
			<li class="content1-3">
				<p>コンテンツ3</p>
				<ul>
					<li>コンテンツ3-1</li>
					<li>コンテンツ3-2</li>
					<li>コンテンツ3-3</li>
				</ul>
			</li>
		</ul>
	</li>
	<li>
		<p class="ac2 open1">アコーディオン2</p>
		<ul class="inner">
			<li class="content2-1">
				<p>コンテンツ1</p>
				<ul>
					<li>コンテンツ1-1</li>
					<li>コンテンツ1-2</li>
					<li>コンテンツ1-3</li>
				</ul>
			</li>
			<li class="content2-2">
				<p>コンテンツ2</p>
				<ul>
					<li>コンテンツ2-1</li>
					<li>コンテンツ2-2</li>
					<li>コンテンツ2-3</li>
				</ul>
			</li>
			<li class="content2-3">
				<p>コンテンツ3</p>
				<ul>
					<li>コンテンツ3-1</li>
					<li>コンテンツ3-2</li>
					<li>コンテンツ3-3</li>
				</ul>
			</li>
		</ul>
	</li>
	<li>
		<p class="ac3 open1">アコーディオン3</p>
		<ul class="inner">
			<li class="content3-1">
				<p>コンテンツ1</p>
				<ul>
					<li>コンテンツ1-1</li>
					<li>コンテンツ1-2</li>
					<li>コンテンツ1-3</li>
				</ul>
			</li>
			<li class="content3-2">
				<p>コンテンツ2</p>
				<ul>
					<li>コンテンツ2-1</li>
					<li>コンテンツ2-2</li>
					<li>コンテンツ2-3</li>
				</ul>
			</li>
			<li class="content3-3">
				<p>コンテンツ3</p>
				<ul>
					<li>コンテンツ3-1</li>
					<li>コンテンツ3-2</li>
					<li>コンテンツ3-3</li>
				</ul>
			</li>
		</ul>
	</li>
</ul>
              
            
!

CSS

              
                p {margin: 0;}
ul {margin: 0;padding: 0;}
li {list-style: none;}

.accordion9 {text-align: center;}
.accordion9 {height: 300px; max-width: 1000px; margin: 0 auto; overflow: hidden;}
.accordion9 li p { float: left; width: 20%; cursor: pointer;}
.accordion9 li .inner { float: left; width: 40%; height: 300px;display: none; margin: 0;}
.accordion9 .inner {display: none;}
.accordion9 .inner li ul{display: none;clear: both; height: 80%;}
.accordion9 p{cursor: pointer;}
.accordion9 p.ac1, .accordion9 p.ac2, .accordion9 p.ac3{width: 20%; height: 300px;}
.accordion9 p.ac1{background: #F50057;}
.accordion9 p.ac2{background: #FFEA00;}
.accordion9 p.ac3{background: #64DD17;}
.accordion9 .inner > li {float: left; width: calc(100% / 3); height: 300px;}
.accordion9 .inner li ul li{height: calc(100% / 3);box-sizing: border-box;}
.accordion9 .inner li > p{cursor: pointer; width: 100%; height:20%;}
.accordion9 .inner li.content1-1{background: #F48FB1;}
.accordion9 .inner li.content1-1 li:nth-child(1){background: #f5a9c2;}
.accordion9 .inner li.content1-1 li:nth-child(2){background: #f5c1d3;}
.accordion9 .inner li.content1-1 li:nth-child(3){background: #f5dae3;}
.accordion9 .inner li.content1-2{background: #F8BBD0;}
.accordion9 .inner li.content1-2 li:nth-child(1){background: #f7cbda;}
.accordion9 .inner li.content1-2 li:nth-child(2){background: #f7dce6;}
.accordion9 .inner li.content1-2 li:nth-child(3){background: #f7edf1;}
.accordion9 .inner li.content1-3{background: #FCE4EC;}
.accordion9 .inner li.content1-3 li:nth-child(1){background: #fcebf1;}
.accordion9 .inner li.content1-3 li:nth-child(2){background: #fcf2f6;}
.accordion9 .inner li.content1-3 li:nth-child(3){background: #fcfafb;}
.accordion9 .inner li.content2-1{background: #FFF59D;}
.accordion9 .inner li.content2-1 li:nth-child(1){background: #fff8b8;}
.accordion9 .inner li.content2-1 li:nth-child(2){background: #fffad1;}
.accordion9 .inner li.content2-1 li:nth-child(3){background: #fffdeb;}
.accordion9 .inner li.content2-2{background: #FFF9C4;}
.accordion9 .inner li.content2-2 li:nth-child(1){background: #fffbd6;}
.accordion9 .inner li.content2-2 li:nth-child(2){background: #fffde8;}
.accordion9 .inner li.content2-2 li:nth-child(3){background: #fffefa;}
.accordion9 .inner li.content2-3{background: #fffbd9;}
.accordion9 .inner li.content2-3 li:nth-child(1){background: #fffce3;}
.accordion9 .inner li.content2-3 li:nth-child(2){background: #fffded;}
.accordion9 .inner li.content2-3 li:nth-child(3){background: #fffef7;}
.accordion9 .inner li.content3-1{background: #C5E1A5;}
.accordion9 .inner li.content3-1 li:nth-child(1){background: #cde0b6;}
.accordion9 .inner li.content3-1 li:nth-child(2){background: #d5e0c8;}
.accordion9 .inner li.content3-1 li:nth-child(3){background: #dde0da;}
.accordion9 .inner li.content3-2{background: #DCEDC8;}
.accordion9 .inner li.content3-2 li:nth-child(1){background: #e1edd3;}
.accordion9 .inner li.content3-2 li:nth-child(2){background: #e7eddf;}
.accordion9 .inner li.content3-2 li:nth-child(3){background: #ecedeb;}
.accordion9 .inner li.content3-3{background: #F1F8E9;}
.accordion9 .inner li.content3-3 li:nth-child(1){background: #f3f7ed;}
.accordion9 .inner li.content3-3 li:nth-child(2){background: #f5f7f2;}
.accordion9 .inner li.content3-3 li:nth-child(3){background: #f7f7f7;}
              
            
!

JS

              
                $(function() {

    //.accordion9の中のli要素の中の.open1がクリックされた時
	$('.accordion9 li .open1').click(function() {

		//クリックされた.accordion9の中のli要素の中の.open1の次の要素の横幅を開いたり閉じたりする。
		$(this).next().animate({width:'toggle'});

		//クリックされた.accordion9の中のli要素の中の.open1ではない.open1の次の要素の横幅を閉じる。
		$('.accordion9 li .open1').not($(this)).next().animate({width:'hide'});

	});

    //.accordion9の中の.innerの中のli要素の中のp要素がクリックされた時
	$('.accordion9 .inner li p').click(function() {

		//クリックされた.accordion9の中の.innerの中のli要素の中のp要素に隣接するul要素を開いたり閉じたりする。
		$(this).next('ul').slideToggle();

	});
});
              
            
!
999px

Console