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.


                <div class="oddbirds">
  <input type="radio" name="toggle" id="eric-toggle" checked/>
  <input type="radio" name="toggle" id="carl-toggle" />
  <input type="radio" name="toggle" id="jonny-toggle" />
  <div class="tabs">
    <label for="eric-toggle">Eric</label>
    <label for="carl-toggle">Carl</label>
    <label for="jonny-toggle">Jonny</label>
  <div class="content">
    <div class="eric-content">
      Responsive CSS Tabs in Sass, 
      with help from the float isolation method.
        <li>Container wraps all tabs dynamically</li>
        <li>Container remains equal-height</li>
        <li>No JS Height calculations</li>
        <li>The entire thing is responsive</li>
    <div class="carl-content">
      Carl is a coder, Pythonista, & Django developer.
    <div class="jonny-content">
      Jonny is a front-end developer & philosophy professor.
        <li>Lorem ipsum dolor sit amet.</li>
        <li>Aliquam tincidunt mauris eu risus.</li>
        <li>Vestibulum auctor dapibus neque.</li>
        <li>Lorem ipsum dolor sit amet.</li>
        <li>Aliquam tincidunt mauris eu risus.</li>
        <li>Vestibulum auctor dapibus neque.</li>


                @import "compass/css3";

@import "compass";

/* Tab Settings */
$default-checked-selector : ':checked';
$default-nested-selectors : null;

$toggle-attribute   : id;
$title-attribute    : for;
$content-attribute  : class;

/* Tab Toggle Defaults */
%gone {
  position: absolute;
  top: -9999px;
  left: -9999px;
%hide-tab-toggle { @extend %gone; }

/* Tab Content Defaults */
%hide-tab-content {
  @include transition(opacity 300ms);
  opacity: 0; /* Hide */
  float: left; /* Isolation */
  width: 100%; /* Isolation */
  margin-right: -100%; /* Isolation */
%show-tab-content {
  opacity: 1; /* Show */
  position: relative; /* Bring to top */
  z-index: 10; /* Bring to top */
%active-tab-title {
  background: none;
  border-bottom-color: rgba(black, 0);

/* Tabs Mixin */
@mixin tabs(
  $nested: $default-nested-selectors,
  $checked: $default-checked-selector
) {
  $nested-tabs: $nested;
  $nested-content: $nested;
  @if length($nested) > 1 {
    $nested-tabs: nth($nested, 1);
    $nested-content: nth($nested, 2);

  @each $slug in $slugs {
    $toggle   : '[#{$toggle-attribute}*="#{$slug}"]';
    $title    : '[#{$title-attribute}*="#{$slug}"]';
    $content  : '[#{$content-attribute}*="#{$slug}"]';

    #{$content} { @extend %hide-tab-content; }
    #{$toggle} {
      @extend %hide-tab-toggle;
      &#{$checked} {
        & ~ #{$nested-tabs} #{$title} {
          @extend %active-tab-title !optional;
        & ~ #{$nested-content} #{$content} {
          @extend %show-tab-content;

/* Creating Tabs */
.oddbirds {
  @include tabs(eric carl jonny, ".tabs" ".content");

/* Paint Job */
* { @include box-sizing(border-box); }

body { 
  @include adjust-leading-to(1.1);
  padding: rhythm(1);
  background: #437691;

.oddbirds {
  @include box-shadow(rgba(black,.5) 0 0 .5em);
  width: 40%;
  max-width: 40em;
  margin: 0 auto;
  background: lightblue;

[for] {
  @include rhythm-borders(1px,.25);
  float: left;
  width: percentage(1/3);
  text-align: center;
  background: #7ac;
  ~ [for] { border-left: 0 }
  &:last-child { float: right; }

.content {
  @include clearfix;
  @include rhythm-borders(1px,.5);
  clear: both;
  border-top: 0;
  ul { 
    list-style: disc; 
    padding-left: rhythm(1);



                // CSS-only tabs made easy with Sass.

// This demonstrates how I use the float isolation method, along with opacity and z-index, to create a responsive tab container. 

// - Container wraps all tabs dynamically
// - Container size remains equal across tabs
// - No JS height calculations
// - The entire thing is responsive

// You can use the `display` property instead if you want the container to change sizes depending on its content.