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="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>
              
            
!

CSS

              
                //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;
	}
}
              
            
!

JS

              
                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

Console