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="accordion-tabs">

  <!-- Toggle radio buttons -->
  <input type="radio" name="tabs-activate" id="tab-one" class="activate-tab" checked />
  <input type="radio" name="tabs-activate" id="tab-two" class="activate-tab" />
  <input type="radio" name="tabs-activate" id="tab-three" class="activate-tab" />

  <div class="tabs">
    <!-- Visible tabs -->
    <label for="tab-one" id="tab-one-label" class="tab">Tab One</label>
    <label for="tab-two" id="tab-two-label" class="tab">Tab Two</label>
    <label for="tab-three" id="tab-three-label" class="tab">Tab Three</label>

    <!-- Tab content -->
    <div id="tab-one-tab-content" class="tab-content active">
      <h3>Spit up on light gray carpet instead of adjacent linoleum</h3>
      <p>Sit and stare wake up human for food at 4am or attack feet. All of a sudden cat goes crazy you call this cat food. Sleep in the bathroom sink with tail in the air hiss and stare at nothing then run suddenly away or climb leg. Scratch me there, elevator
        butt unwrap toilet paper plan steps for world domination scratch at the door then walk away so human is washing you why halp oh the horror flee scratch hiss bite and lick the plastic bag climb a tree, wait for a fireman jump to fireman then scratch
        his face. Eat a plant, kill a hand spot something, big eyes, big eyes, crouch, shake butt, prepare to pounce cats making all the muffins yet present belly, scratch hand when stroked tuxedo cats always looking dapper. Pooping rainbow while flying
        in a toasted bread costume in space get video posted to internet for chasing red dot cat slap dog in face and scratch the box love to play with owner's hair tie or lick plastic bags chase ball of string. When in doubt, wash kitty loves pigs cats
        go for world domination yet chase after silly colored fish toys around the house so if it smells like fish eat as much as you wish. Scratch leg; meow for can opener to feed me scratch leg; meow for can opener to feed me so hide when guests come
        over poop in litter box, scratch the walls for under the bed, but meow meow yet eats owners hair then claws head. Touch water with paw then recoil in horror. </p>
    </div>
    <div id="tab-two-tab-content" class="tab-content">
      <h3>Soft kitty warm kitty little ball of furr plan steps for world domination</h3>
      <p>I like big cats and i can not lie gnaw the corn cob. Pee in human's bed until he cleans the litter box. Jump around on couch, meow constantly until given food, going to catch the red dot today going to catch the red dot today put butt in owner's
        face has closed eyes but still sees you yet kitty scratches couch bad kitty if it smells like fish eat as much as you wish yet poop on grasses. Rub whiskers on bare skin act innocent the dog smells bad chase ball of string. Relentlessly pursues
        moth kick up litter pounce on unsuspecting person purrrrrr. Lie on your belly and purr when you are asleep. Hide from vacuum cleaner peer out window, chatter at birds, lure them to mouth yet meowing chowing and wowing but the dog smells bad so
        cats making all the muffins chase ball of string. Chirp at birds my slave human didn't give me any food so i pooped on the floor for tuxedo cats always looking dapper or need to chase tail if it fits, i sits. Hide head under blanket so no one
        can see lie on your belly and purr when you are asleep stares at human while pushing stuff off a table all of a sudden cat goes crazy, for stares at human while pushing stuff off a table bathe private parts with tongue then lick owner's face for
        intently sniff hand.</p>
    </div>
    <div id="tab-three-tab-content" class="tab-content">
      <h3>Chase imaginary bugs wack the mini furry mouse man running from cops stops to pet cats, goes to jail
</h3>
      <p>Hate dog fooled again thinking the dog likes me so show belly wake up human for food at 4am. Walk on car leaving trail of paw prints on hood and windshield kick up litter attack dog, run away and pretend to be victim rub whiskers on bare skin act
        innocent lies down wake up wander around the house making large amounts of noise jump on top of your human's bed and fall asleep again. Lick face hiss at owner, pee a lot, and meow repeatedly scratch at fence purrrrrr eat muffins and poutine until
        owner comes back.</p>
    </div>
  </div>

</div>
              
            
!

CSS

              
                  * {
    box-sizing: border-box;
  }
  
  .accordion-tabs {
    margin: 20px;
    // Hide radio buttons
    .activate-tab {
      position: absolute;
      left: -10000px;
    }
    // Tab container
    .tabs {
      display: flex;
      justify-content: space-between;
      flex-wrap: wrap;
      // Tabs styling
      .tab {
        display: inline-block;
        padding: 10px;
        vertical-align: top;
        background-color: #ccc;
        cursor: hand;
        cursor: pointer;
        border-left: 1px solid #fff;
        flex-grow: 1;
        &:hover {
          background-color: #fff;
        }
      }
      // Tab content styling
      .tab-content {
        background-color: #fff;
        padding: 20px 20px 20px 10px;
        min-height: 300px;
        display: none;
        width: 100%;
        flex-basis: auto;
      }
    }
  }
  
  // Tab active state styling
  #tab-one:checked ~ .tabs #tab-one-label,
  #tab-two:checked ~ .tabs #tab-two-label,
  #tab-three:checked ~ .tabs #tab-three-label {
    background-color: #fff;
    cursor: default;
    border-left: none;
  }
  
  // Tab content active state styling
  #tab-one:checked ~ .tabs #tab-one-tab-content,
  #tab-two:checked ~ .tabs #tab-two-tab-content,
  #tab-three:checked ~ .tabs #tab-three-tab-content {
    display: block;
  }
  
  // Accordion functionality on screen <768px
  @media (max-width: 767px) {
    .tabs {
      // Switch from tabs to accordion
      flex-direction: column;
      // Define item order on smaller screen (I would do this in JS instead to remove manual work)
      #tab-one {
        &-label {
          order: 1;
        }
        &-tab-content {
          order: 2;
        }
      }
      #tab-two {
        &-label {
          order: 3;
        }
        &-tab-content {
          order: 4;
        }
      }
      #tab-three {
        &-label {
          order: 5;
        }
        &-tab-content {
          order: 6;
        }
      }
    }
    // Accordion tab active state styling
    #tab-one:checked ~ .tabs #tab-one-label,
    #tab-two:checked ~ .tabs #tab-two-label,
    #tab-three:checked ~ .tabs #tab-three-label {
      background-color: #f8f8f8;
      border-bottom: 1px solid #ccc;
    }
  }
              
            
!

JS

              
                
              
            
!
999px

Console