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

              
                <div class="tab-component">
	<ul class="navigation-wrap">
		<li class="tab active" data-id="1"><label>1</label></li>
		<li class="tab" data-id="2"><label>2</label></li>
		<li class="tab" data-id="3"><label>3</label></li>
	</ul>
	<div class="content-wrap">
		<div class="content active" data-id="1">
			<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.</p>
		</div>
		<div class="content" data-id="2">
			<p>It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s.</p>
		</div>
		<div class="content" data-id="3">
			<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. It has a more or less normal distribution.</p>
		</div>
	</div>
</div>
              
            
!

CSS

              
                @keyframes pulse{
	0%{
		transform: scale(1);
	}
	50%{
		transform: scale(1.2);
	}
	100%{
		transform: scale(1);
	}
}

html, body{
	height: 100%;
}

body{
	background: #f0f0f0;
	display: flex;
	justify-content: center;
	align-items: center;
	font-size: 18px;
	font-family: 'Montserrat', sans-serif;
	font-weight: 400;
	color: #333;
}

p{
	line-height: 1.4;
}

.tab-component{
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 360px;
	background: #fff;
	border-top-right-radius: 30px;
	border-bottom-left-radius: 30px;
  
	.navigation-wrap{
		display: flex;
		flex-direction: row;
    
		li{
			flex: 1;
			font-weight: 700;
			text-align: center;
			padding: 30px 10px;
			border-top: 1px solid #333;
			border-right: 1px solid #333;
			font-size: 40px;
			position: relative;
			
			label{
				pointer-events: none;
				display: block;
			}
		}
		
		li:not(.active){
			cursor: pointer;
			border-bottom: 1px solid #333;
		}
		
		li:not(.active):hover{
			background: #fafafa;
		}
		
		li:not(.active):after{
			content: "";
			position: absolute;
			left: 0;
			bottom: 0;
			height: 4px;
			background: rgba(0,0,0,0.1);
			width: 100%;
		}
		
		li:first-child{
			border-left: 1px solid #333;
		}
		
		li:last-child{
			border-top-right-radius: 30px;
		}
		
		li.active label{
			animation: pulse 0.4s 1 ease-out;
		}
	}
	
	.content-wrap{
		border: 1px solid #333;
		border-top: 0;
		border-bottom-left-radius: 30px;
		
		.content{
			opacity: 0;
			pointer-events: none;
			padding: 30px;
			position: absolute;
			transform: translateY(10px);
		}
		
		.content.active{
			opacity: 1;
			pointer-events: all;
			position: static;
			transition: 500ms;
			transform: translateY(0px);
		}
	}
}
              
            
!

JS

              
                document.querySelector('.tab-component').addEventListener('click',function(e){
	if(e.target.classList.contains('tab') && !e.target.classList.contains('active')){
		document.querySelector('.tab-component .tab.active').classList.remove('active');
		document.querySelector('.tab-component .content.active').classList.remove('active');
		e.target.classList.add('active');
		document.querySelector('.tab-component .content[data-id="'+e.target.dataset.id+'"]').classList.add('active');
		
	}
})
              
            
!
999px

Console