cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <div class="container">
	<ul class="tab-menu">
		<li tabindex="0">みみたぶ</li>
		<li tabindex="0">たんこぶ</li>
	</ul>
	<div class="tab-content">
		<div>
      ヒトの耳たぶの付き方の類型には、頭部から離れて垂れ下がる形となる分離型と、頭部となだらかにつながった輪郭を描く密着型とがある。
これらの形状は遺伝によって決定されるもので、メンデルの優性の法則に従う。分離型は優性、密着型は劣性の対立遺伝子による形質で、分離型と密着型両方の遺伝子をもつ場合は分離型が発現する。
分離型で特に分厚く肉付きが良いものは東洋では福運があるとされる。福耳を参照。
		</div>
		<div>
			内出血
		</div>
	</div>
</div>
            
          
!
            
              .container {
  width: 900px;
  margin: 0 auto;
  padding: 20px;
}

.tab-menu {
  display: table;
  list-style-type: none;
  margin: 0;
  padding: 0;
  width: 100%;
  text-align: center;
}

.tab-menu > li {
  cursor: pointer;
  display: table-cell;
  padding: 10px 0;
  border: 1px solid #e7da9c;
}

.tab-menu > li:first-child {
  border-right: 0;
}

.tab-menu > .active {
  transition: .5s;
  cursor: default;
  background-color: #ec9176;
  outline: none;
  color: #fff;
  font-weight: bold;
}

.tab-content > div {
  background-color: #f8ede9;
  padding: 20px;
  letter-spacing: 3px;
}
            
          
!
            
              $(function () {
    //子要素を取得する
		var $tabMenu = $('.tab-menu').children();
		var $tabContent = $('.tab-content').children();
    //activeを定義する
		var activeClass = 'active';

    //一番目の子要素にactiveを追加する
		$tabMenu.first().addClass(activeClass);
    //一番目以外の要素は隠す
		$tabContent.not(':first').hide();
   //クラスの追加と削除とリセットをする
		$tabMenu.on('click', function () {
			var index = $(this).index();
			$tabMenu.removeClass(activeClass);
			$(this).addClass(activeClass);
			$tabContent.hide().eq(index).fadeIn();
		});
	});
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console