Pen Settings



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


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


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.


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.


                <section class="tab-group">
  <div class="tab-container">
    <button type="button" class="tab">Tab 1</button>
    <button type="button" class="tab">Tab 2</button>
    <button type="button" class="tab">Tab 3</button>
  <div class="article-container">
    <article class="tab-content">
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec rhoncus consequat turpis eu lobortis. Vivamus varius ligula eu libero suscipit, ac commodo quam semper.</p>
    <article class="tab-content">Ipsum 2</article>
    <article class="tab-content">Dolor 3</article>


                $group-width: 60vw;
$border-radius: 6px;
$manilla: #eee6c7;

body {
  background-color: rgb(22, 22, 26);  

h2 {
  margin: 0 0 0.5em 0;
p {
  margin: 0;

.tab-group {
  height: 100vh;
  display: flex;
  flex-flow: column nowrap;
  align-items: center;
  justify-content: center;
  border: 1px solid red;
  font-family: 'PT Mono', monospace;

.article-container {
  position: relative;
  width: $group-width;
  height: 50vh;
  background-color: $manilla;
  border-radius: 0 $border-radius $border-radius $border-radius;
} {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.333em 1.666em 2em 1em;
  opacity: 0;
  // transform: scale(0.9);
  // transition: opacity 0.5s ease-in;
  &.active {
    opacity: 1;
    // transform: scale(1);
    // animation: scale-in-tl 0.5s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;

.tab-container {
  height: 3em;
  width: $group-width;
  display: flex;
  justify-content: flex-start;
  button {    
    border: none;
    box-shadow: none;
    cursor: pointer;
    padding: 1em;
    outline: none;
    transform: translateY(3px);
    transition: transform 200ms ease;
    border-radius: $border-radius $border-radius 0 0;
    margin-right: 0.333em;
    font-family: inherit;
    &:hover {
      transform: translateY(0);

.tab {
  background-color: darken($manilla, 12%);
  &.active {
    background-color: $manilla;



// forEach method, could be shipped as part of an Object Literal/Module
function forEach (array, callback, scope) {
  for (var i = 0; i < array.length; i++) {, i, array[i]); // passes back stuff we need

// Usage:
// optionally change the scope as final parameter too, like ECMA5
/*var myNodeList = document.querySelectorAll('li');
forEach(myNodeList, function (index, value) {
  console.log(index, value); // passes index + value back!

// make an array (nodelist) of tab nodes
var tabNodes = document.querySelectorAll('.tab-group');

// make an array (nodelist) of article nodes
var articleNodes = document.querySelectorAll('.tab-group');

// set the first article node to be active

// run through all tabNodes and add event listeners
forEach(tabNodes, function (index, value) {
  //console.log(index, value); // passes index + value back!
  value.addEventListener("click", function(){ handleTab(index); })

// function that runs when clicking on a tab
function handleTab(i) {
  //console.log(index, value); // passes index + value back!
  // Remove all active classes first
  forEach(articleNodes, function (index, value) {
  // Then add an active class to the article that matches the tab clicked