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="tabcontent">
  <h1>Tabbed Content</h1>  
  <nav>
        <a href="#cont1" rel="tabcont1">Tab Title 1</a>
        <a href="#cont2" rel="tabcont2">Tab Title 2</a>
        <a href="#cont3" rel="tabcont3">Tab Title 3</a>
    </nav>
    <div class="tab" id="tabcont1">
    	<h2>Tab Content 1</h2>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean sodales felis sed augue congue cursus. Sed nisl leo, congue sed tincidunt non, interdum quis nunc. Nam dictum tempor dolor, ac elementum tellus molestie ac. Integer semper sem id ipsum bibendum venenatis. Nunc mattis urna et mi pharetra gravida. Suspendisse ultrices condimentum ipsum at vehicula. Praesent vitae ante non nibh lobortis volutpat. Aliquam sit amet metus eu lorem posuere lobortis.</p>
    </div>
    <div class="tab" id="tabcont2">	
    	<h2>Tab Content 2</h2>
        <p>Nulla facilisi. Nam et libero a nunc lobortis accumsan vitae nec arcu. Curabitur et dui velit, at viverra lectus. Duis enim diam, imperdiet non rhoncus id, feugiat ac lorem. Praesent at sem vitae velit feugiat viverra. Nulla consequat facilisis vehicula. Praesent sapien odio, feugiat non porta sagittis, sagittis nec est.</p>
    </div>
    <div class="tab" id="tabcont3">
    	<h2>Tab Content 3</h2>
        <p>Vestibulum tincidunt ultricies dui, eget dictum mi hendrerit eget. Aliquam erat volutpat. Nullam venenatis lobortis faucibus. Curabitur eu odio mauris. In venenatis purus diam, in convallis mauris. Etiam ultricies erat ac odio dictum quis consectetur nisl fringilla. Praesent aliquet erat id nulla consequat luctus. Praesent dolor orci, volutpat et semper et, pharetra eu ipsum.</p>
    </div>
</div>
              
            
!

CSS

              
                body {
  background-color:#eee;
  color:#444;
  font-family:sans-serif;
}
h1 {
  margin:0 0 30px;
  font-weight:normal;
}
h2 {
  margin:0 0 10px;
  font-weight:normal;
}
.tabcontent { 
  width:600px;
  background-color:#fff;
  border-radius:5px;
  box-shadow:0 0 10px rgba(0,0,0,.3);
  margin:auto;
  padding:35px;
  overflow:hidden;
}
.tabcontent nav { 
  background-color:#ddd; 
  box-shadow:inset 0 0 5px #bbb; 
  margin:0 -40px 25px; 
  padding:5px 40px 0; 
  overflow:hidden;
}
.tabcontent nav a { 
  display:block; 
  float:left; 
  margin-right:5px; 
  padding:5px 15px 9px; 
  color:#888; 
  font-size:16px; 
  font-weight:400; 
  line-height:1; 
  text-decoration:none; 
}
.tabcontent nav a:hover { 
  color:#222; 
}
.tabcontent nav a.active { 
  background-color:#fff; 
  border-radius:5px 5px 0 0; 
  box-shadow:0 0 5px #bbb; 
  padding:7px 15px; 
  color:#f90; 
}
              
            
!

JS

              
                $().ready(function(){
	
	$(".tabcontent nav a:first").addClass('active');
	$(".tabcontent .tab").hide();
	$(".tabcontent .tab:first").show();
	
	function tabContent(name){
		var $this = $(".tabcontent nav").find("[rel='"+name+"']");
		var $rel = name;
		$(".tabcontent nav a").removeClass('active');
		$this.addClass('active');
		$(".tabcontent .tab").hide();
		$('#'+$rel).show();
	}
	$(".tabcontent nav a").click(function(e){
		var $rel = $(this).attr('rel');
		tabContent($rel);
	});
	if(window.location.hash && window.location.hash!="#"){
		$rel = window.location.hash.replace('#','tab');;
		tabContent($rel);
  }

});
              
            
!
999px

Console