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="tabs">
	<ul id="tab-links">
		<li><a href="#tab-1" class="active" data-tab-nav>Code</a></li>
		<li><a href="#tab-2" data-tab-nav>Graphic Design &amp; Illustration</a></li>
		<li><a href="#tab-3" data-tab-nav>Web Design</a></li>
		<li><a href="#tab-4" data-tab-nav>Business</a></li>
		<li><a href="#tab-5" data-tab-nav>Photography &amp; Video</a></li>
	</ul>
	
	<section id="tab-1" class="active">
		<p>Thousands of free tutorials and online courses to help you learn software development from mobile devices to web applications and everything in between.</p>
		<p>Join our community to improve your coding skills and workflow. What would you like to learn?</p>
	</section>
	
	<section id="tab-2">
		<p>Keep up to date or learn a new skill with our graphic design and illustration content.</p>
		<p>Ranging from Adobe Photoshop to drawing theory, from vector illustration to print design, we've got all experience levels covered.</p>
	</section>
	
	<section id="tab-3">
		<p>Free tutorials, learning guides, and online courses to help you learn web design.</p>
		<p>Whether it’s interface design, UX, front-end development, motion design, accessibility, business, or something you’ve not yet discovered, our team of expert instructors have you covered!</p>
	</section>
	
	<section id="tab-4">
		<p>Do you need to learn a new business skill quickly? Discover how to start a profitable business, use the latest business software, and level up your career—with thousands of free business tutorials taught by expert instructors.</p>
	</section>
	
	<section id="tab-5">
		<p>Free tutorials, learning guides, and online courses to help you learn photo and video skills.</p>
		<p>Whether it’s digital imaging, editing and post-production, visual storytelling, business, or something you’ve not yet discovered, our team of expert instructors have you covered!</p>
	</section>
</div>
              
            
!

CSS

              
                // Variables.
$body-bg: #272635;
$link-bg: #11111A;
$link-color: rgba(255, 255, 255, .6);
$active-link-color: $body-bg;
$white: #fff;
$text-color: #2C2C2C;

// For demo purposes only.
body {
	display: flex;
	justify-content: center;
	padding: 3rem;
	background: $body-bg;
	color: $text-color;
}

// Tab styling.
.tabs {
	max-width: 100%;
	
	@media only screen and (min-width: 700px) {
        max-width: 60rem;
    }

	> ul {
		display: none;

		@media only screen and (min-width: 700px) {
			display: flex;
		}

		list-style-type: none;
		padding: 0;
		margin: 0 1rem;

		li {
			margin-right: .25rem;
			text-align: center;
			
			a {
				display: block;
				text-decoration: none;
				background: $link-bg;
				padding: 1rem 1.5rem;
				color: $link-color;
				transition: all .2s ease-in-out;
				height: calc(100% - 2rem);
				
				&.active {
					background: $white;
					color: $text-color;
				}
				
				&:hover:not(.active) {
					color: $white;
				}
			}
		}
	}
	
	section {
		background: $white;
		padding: 1.5rem 2.5rem;
		display: none;
		
		&.active {
			display: block;
		}
	}
}

// Accordion styling.
.accordion-heading {
	display: block;
	
	@media only screen and (min-width: 700px) {
		display: none;
    }
	
	text-decoration: none;
	background: $link-bg;
	padding: 1.5rem 2.5rem;
	color: $link-color;
	transition: all .2s ease-in-out;
	
	&.active {
		font-weight: bold;
		background: $white;
		color: $text-color;
	}

	&:hover:not(.active) {
		color: $white;
	}
}
              
            
!

JS

              
                $(function() {
	// Reference the tab links.
	const tabLinks = $('#tab-links li a');
	
	// Generate accordion headings for each section.
	tabLinks.each(function(index) {
		var $this = $(this);
		
		// If this is the first item, add the active class.
		if (index == 0) {
			$this.addClass('active');
		}
		
		$($this.attr('href')).before($this.clone().addClass('accordion-heading'));
	});

	// Handle link clicks.
	$('[data-tab-nav]').click(function(event) {
		var $this = $(this),
			target = $this.attr('href');
		
		// Prevent default click behaviour.
		event.preventDefault();
		
		// Remove the active class from the active link and section.
		$('#tab-links a.active, section.active, .accordion-heading.active').removeClass('active');
		
		// Add the active class to the current link, corresponding section and accordion heading.
		$(target).addClass('active');
		$('a[href^="' + target + '"]').addClass('active');
	});
});
              
            
!
999px

Console