Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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 data-tabs class="tabs">    
   <div class="tab">
      <input type="radio" name="tabgroup" id="tab-1" checked>
      <label for="tab-1">Tab 1</label>
      <div class="tab__content">
         <h4>Tab heading 1</h4>
         <p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Incidunt libero ipsum, veniam magni modi exercitationem debitis ducimus assumenda ratione corporis, illum eius, laborum tempore cumque amet id perspiciatis nostrum unde?</p>
         <p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Ipsum, maiores.</p>
      </div> 
   </div>
   <div class="tab">
      <input type="radio" name="tabgroup" id="tab-2">
      <label for="tab-2">Tab 2</label>
      <div class="tab__content">
         <h4>Tab heading 2</h4>
         <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Consectetur odio cum eveniet excepturi eum provident molestias ad ipsa unde dignissimos illo porro animi earum aliquam perspiciatis id omnis, adipisci incidunt. Qui, beatae. Beatae animi totam obcaecati at quae, iste facere fuga nemo pariatur esse nihil?</p>
         <p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Doloremque commodi eos voluptatem numquam pariatur deleniti repellat fugiat eligendi nulla molestiae sunt praesentium vero sequi distinctio error quibusdam maiores natus magnam, explicabo hic sed alias dolores, quis eum! Reprehenderit atque cupiditate dolorum? Saepe, doloribus veniam? Nulla!</p>
      </div> 
   </div>
   <div class="tab">
      <input type="radio" name="tabgroup" id="tab-3">
      <label for="tab-3">Tab 3</label>
      <div class="tab__content">
         <h4>Tab heading 3</h4>
         <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Laboriosam officiis voluptas maiores deserunt ullam aliquam?</p>
         <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Accusamus, officia accusantium quod fuga porro eius animi earum excepturi omnis! Reprehenderit!</p>
      </div> 
   </div>
   <div class="tab">
      <input type="radio" name="tabgroup" id="tab-4">
      <label for="tab-4">Tab 4</label>
      <div class="tab__content">
         <h4>Tab heading 4</h4>
         <p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Officia exercitationem veritatis vero eaque. Nam totam dolorem sapiente ullam non sed nostrum praesentium voluptatem, ad quam libero deserunt nemo fuga hic repudiandae veritatis cupiditate, mollitia recusandae!</p>
      </div> 
   </div>
</div>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Open+Sans');

body {
   font-family: 'Open Sans', sans-serif;
   background-color: #C2EABA;
   padding-top: 50px;
   line-height: 1.4;
   font-size: 1.4em;
}

.tabs {
	clear: both;
	position: relative;   
   max-width: 650px;
   margin: 0 auto;
   /* you can either manually set a min-height here or do it via JS ---> */
}

.tab {
	float: left;
}

.tab label {
	margin-right: 20px;
	position: relative;
	top: 0;
	cursor: pointer;
	color: #333;
   text-transform: uppercase;
}

.tab [type=radio] {
	display: none;   
}

.tab__content {
   position: relative;
	top: 40px;
	left: 0;
	right: 0;
	bottom: 0;
	transition: opacity .2s cubic-bezier(.42,0,.34,1.01);
	opacity: 0;
}

[type=radio]:checked ~ label {
	border-bottom: 2px solid #1d1d1d;
	color: #1d1d1d;
	z-index: 2;
}

[type=radio]:checked ~ label ~ .tab__content {
	z-index: 1;
	opacity: 1;
}
              
            
!

JS

              
                (function($, document) {
    
      // get tallest tab__content element
      let height = -1;

		$('.tab__content').each(function() {
			height = height > $(this).outerHeight() ? height : $(this).outerHeight();
         $(this).css('position', 'absolute');
		});
      
      // set height of tabs + top offset
		$('[data-tabs]').css('min-height', height + 40 + 'px');
   
}(jQuery, document));
              
            
!
999px

Console