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

              
                h2 No Scipt / No Reload Tab Navigation
.tab-bar
  input#tab-1-rb.hidden(type='radio' name='tab-bar-item' checked='')
  .tab-container
    .trapezoid
    a.tab(href='#')
      label(for='tab-1-rb') Tab 1
  input#tab-2-rb.hidden(type='radio' name='tab-bar-item')
  .tab-container
    .trapezoid
    a.tab(href='#')
      label(for='tab-2-rb') Tab 2
  input#tab-3-rb.hidden(type='radio' name='tab-bar-item')
  .tab-container
    .trapezoid
    a.tab(href='#')
      label(for='tab-3-rb') Tab 3
  .texts
    .text1
      .text Hello, this is Tab 1 text!
    .text2
      .text Hello, this is Tab 2 text!
    .text3
      .text Hello, this is Tab 3 text!

              
            
!

CSS

              
                // Please configure the following
$tab-border-width: 2px;
$tab-content-width: 6ch; // this is an estimation and will break depending on the font
$tab-padding-x: 2ch;
$tab-padding-y: .4em;
$tab-side-border-coefficient: 2ch;

// Please don't touch these variables
$tab-border-x-coefficient: 4;
$tab-height: 1em + 2 * $tab-padding-y;
$tab-width: $tab-content-width + 2 * $tab-padding-x + 2 * $tab-side-border-coefficient;

// Here are the rules
.hidden {
  display: none;
}

.tab {
  color: black;
  display: block;
  font-weight: bold;
  height: $tab-height;
  position: relative;
  text-align: center;
  text-decoration: none;
  width: calc(#{$tab-width} - #{$tab-border-x-coefficient} * #{$tab-border-width});
  z-index: 1;
  
  &:visited {
    color: black;
  }

  > label {
    cursor: pointer;
    display: inline-block;
    width: 100%;
    height: 100%;
  }
}

.tab-bar {
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  
  > input[name="tab-bar-item"]:checked + .tab-container {
    margin-top: $tab-border-width;
    
    > .trapezoid::before {
      border-bottom: calc(#{$tab-height} + #{$tab-border-width}) solid black;
    }
  }
}

.tab-container {
  margin: 0 $tab-border-width;
  width: max-content;
  
  &:nth-child(2) {
    margin-left: calc(2 * #{$tab-border-width});
  }
}

.text {
  box-sizing: border-box;
  padding: 1em 1ch;
}

.texts {
  flex-basis: 100%;
  margin-top: -$tab-padding-y;
}

#tab-1-rb:checked ~ .texts .text1 {
  height: max-content;
}
.text1 {
  background-color: hsl(0, 50%, 70%);
  height: 0;
  overflow: hidden;
}

#tab-2-rb:checked ~ .texts .text2 {
  height: max-content;
}
.text2 {
  background-color: hsl(100, 50%, 70%);
  height: 0;
  overflow: hidden;
}

#tab-3-rb:checked ~ .texts .text3 {
  height: max-content;
}
.text3 {
  background-color: hsl(200, 50%, 70%);
  height: 0;
  overflow: hidden;
}

.trapezoid, .trapezoid::before {
  border-bottom: $tab-height solid white;
  border-left: $tab-side-border-coefficient solid transparent;
  border-right: $tab-side-border-coefficient solid transparent;
  box-sizing: border-box;
  display: block;
  height: 0;
  margin-bottom: calc(-1 * #{$tab-height} + #{$tab-padding-y});
  padding: $tab-padding-y $tab-padding-x;
  position: relative;
  width: $tab-width;
}

.trapezoid::before {
  border-bottom: calc(#{$tab-height} + 2 * #{$tab-border-width}) solid black;
  border-left: calc(#{$tab-side-border-coefficient} + #{$tab-border-width}) solid transparent;
  border-right: calc(#{$tab-side-border-coefficient} + #{$tab-border-width}) solid transparent;
  content: '';
  left: calc(-1 * #{$tab-side-border-coefficient} - 2 * #{$tab-border-width});
  position: absolute;
  top: calc(-1 * #{$tab-border-width});
  width: calc(#{$tab-width} + #{$tab-border-x-coefficient} * #{$tab-border-width});
  z-index: -1;
}

              
            
!

JS

              
                
              
            
!
999px

Console