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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <nav class="nav clearfix">
  <ul class="nav-list">
    <li>2で割る</li>
    <li>px→em</li>
    <li>px→em</li>
    <li>行送り変換</li>
    <li>トラッキング変換</li>  
  </ul>
</nav>
<section class="calc-section calc-section-top">
  <h2 class="calc-section-ttl">とりえあず2で割ってくれる電卓</h2>
    <div class="calc-content">
  </div>
</section>
<section class="calc-section">
  <h2 class="calc-section-ttl">px→em</h2>
  <div class="calc-content">
  </div>
</section>
<section class="calc-section">
  <h2 class="calc-section-ttl">px→rem</h2>
  <div class="calc-content">
  </div>
</section>
<section class="calc-section">
  <h2 class="calc-section-ttl">Photoshopの行送り → line-height</h2>
  <div class="calc-content">
  </div>
</section>
<section class="calc-section">
  <h2 class="calc-section-ttl">Photoshopのトラッキング → letter-spacing</h2>
    <div class="calc-content">
  </div>
</section>

              
            
!

CSS

              
                /*common*/
html{
	font-size:62.5%;
}
body{
  font-size: 1.6rem;
  font-family:"游ゴシック", YuGothic, "ヒラギノ角ゴ Pro", "Hiragino Kaku Gothic Pro", "メイリオ", "Meiryo", sans-serif;
  letter-spacing: 0.05rem;
  line-height: 1.4;
	color: #333;
}
h1,h2,div,section{
  margin:0;
  padding:0;
}
ul,li{
	margin:0;
	padding:0;
	list-style-type: none;
}

.calc-main{
  padding:0 10px;
  max-width: 1020px;
  margin: 40px auto 60px;
}
.calc-section-ttl{
  font-size: 1.8rem;
  padding:10px 20px;
  background: #bbb;
}
/*calc-section*/
.calc-section{
	height: 0;
	visibility: hidden;
	opacity: 0;
	margin: 0;
}

.calc-section.is-open{
	height: auto;
	visibility: visible;
	opacity: 1;
  padding-top: 40px;
}
/*nav*/
.nav{
	border-bottom:3px solid #f7f7f7;
	overflow: hidden;
}
.nav-list{
	width: 100%;
	-webkit-display: flex;
	display: flex;
	vertical-align: bottom;
	position: relative;
}
.nav-list>li{
	position: relative;
	top: -0px;
	width: 20%;
	height: 100%;
	top:0px;
	padding:40px 10px 30px;
	text-align: center;
	box-sizing: border-box;
	background-image: linear-gradient( #a6e9ff 20%,transparent 20%);
	vertical-align: middle;
	-webkit-transition:.3s;
	transition: .3s;

}


.nav-list>li.is-open{
	background-image: linear-gradient( #3ccfff 20%,#f7f7f7 20%);
	top: 10px;
	border-bottom: none
}

@media screen and (max-width: 790px) {	
.nav-list{
		-webkit-flex-wrap:wrap;
		flex-wrap:wrap;
	}
	.nav-list>li{
		width: 33%;
		font-size: 1.4rem;
	}
	.nav-list>li:nth-child(4){
		width: 50%;
	}
	.nav-list>li:nth-child(5){
		width: 50%;
	}
}

              
            
!

JS

              
                $(function(){
  $('.nav-list>li:first').addClass('is-open');
  $('.calc-section:first').addClass('is-open');


  $('.nav-list>li').on('click', function(){
    var nav_index = $('.nav-list>li').index(this);
    $('.nav-list>li').removeClass('is-open');
    $(this).addClass('is-open');

    var sec_index = $('.calc-section').eq(nav_index);

    $('.calc-section').removeClass('is-open');
    sec_index.addClass('is-open');

  });

});
              
            
!
999px

Console