Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <div class="tabbed-content clearfix">
		<!--Tabbed navigation-->
    <ul class="tabs">
      <li class="tab-link current" data-tab="text-tab">Text</li>
			<li class="tab-link" data-tab="video-tab">Video</li>
			<li class="tab-link" data-tab="audio-tab">Audio</li>
	</ul>
	<!--Wrapper to contain interchanging content-->
	<div class="tabs-wrapper">
		<!--textual tab content-->
		<div id="text-tab" class="tab-content current">
			<h2>Heading for tab link one</h2>
			<p>Text to go here blah blah blah</p>
		</div> 
		<!--video tab content-->
		<div id="video-tab" class="tab-content">
			<iframe src="https://www.youtube.com/embed/o8DZxBM9fY0" frameborder="0" allowfullscreen></iframe>
		</div>
		<!--audio tab content-->
		<div id="audio-tab" class="tab-content">
			<audio src="http://robbbenson.com/01%20Angel.mp3" controls preload></audio>
		</div>
	</div>
</div>
            
          
!
            
              //wrapping element
.tabbed-content {
	position: relative;
	margin: 25px 0;
	overflow: hidden;
	font-family: arial, 'sans-serif';
	color: #525252;
}

//tab links block
.tabs{
	margin: 0;
	padding: 0;
	list-style: none;
	float: left;
	line-height: normal;
}

//individual tab link
.tab-link {
	text-transform: uppercase;
	font-size: 2em;
	color: #fff;
	display: block;
	padding: 15px 25px; 
	margin-bottom: 10px;   
	background: #525252;
	cursor: pointer;
	-webkit-border-radius: 10px 0 0 10px;
	-moz-border-radius: 10px 0 0 10px;
	border-radius: 10px 0 0 10px;
	&.current {
		background: #CCCCCC;
    color: #5B5B5B;
	}
}

//tab content wrapper
.tabs-wrapper {
	float: left;
}

//tab content blocks to toggle between
.tab-content{
	display: none;
	border:4px solid #CCCCCC;
	padding: 20px;
	margin:0;
	float: left;
	-webkit-border-radius: 0 10px 10px 10px;
	-moz-border-radius: 0 10px 10px 10px;
	border-radius: 0 10px 10px 10px;
	min-height: 231px;//height of tabs + 10
	width: 100%;
	box-sizing:border-box;
	position: relative;
	-moz-box-sizing:border-box;
	&.current {
		display: inherit;
	}
	*:first-child {
    margin-top:0;
	}
}

@media only screen and (max-width: 650px) {
	.tabs {
		width: 100%;
		float: none;
	}
	.tab-link {
		float: left;
		margin-right: 10px;
		margin-bottom: 0;
		-webkit-border-radius: 10px 10px 0 0;
		-moz-border-radius: 10px 10px 0 0;
		border-radius: 10px 10px 0 0;
	}
	.tabs-wrapper {
		width: 100%;
	}
	.tab-content {
		min-height: 0;
	}
}
            
          
!
            
              var tabbedContent = function() {
		//get all tab link elements
		var tab = document.getElementsByClassName("tab-link");
		//get all tab content elements
		var tabContent = document.getElementsByClassName("tab-content");
		//loop through each tab
		for (var i = 0; i < tab.length; i++) {
				//add click event listener to all tab links
				tab[i].addEventListener('click', function() {
						//each time tab clicked remove all current classes
						//remove 'current' class from all tabs
						for (var i = 0; i < tab.length; i++) {
								tab[i].classList.remove('current');
						};
						//remove 'current' class from all tab content
						for (var i = 0; i < tabContent.length; i++) {
								tabContent[i].classList.remove('current');
						};
						//add current class back to the clicked tab
						this.className += ' current';
						//get data-tab attribute of what has been clicked
						var matchingTab = this.getAttribute('data-tab');
						//add current class to the tabContent element thats id matches the data-tab of the clicked tab
						document.getElementById(matchingTab).className += ' current';
				}, false);
		}
}

tabbedContent();
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console