Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

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 id="wrap">
  <header role="banner">
    <h1>Hide the sidebar!</h1>
    <a
      href="http://twitter.com/genelocklin"
      title="follow me for more awesome shit"
      >by @genelocklin</a
    >
  </header>

  <nav role="navigation"></nav>

  <input type="checkbox" id="width_sidebar" role="button" />
  <label for="width_sidebar" onclick=""
    ><span>hide the sidebar</span><span>&raquo;</span
    ><span>&laquo;</span></label
  >

  <div role="main">
    <article class="post">
      <h1 itemprop="headline">Hide the Sidebar!</h1>
      <p>Toggle the button to the right, to hide the sidebar.</p>
      <h2>The Pandorica Opens</h2>
      <p>
        Father Christmas. Santa Claus. Or as I've always known him: Jeff. I'm
        the Doctor. Well, they call me the Doctor. I don't know why. I call me
        the Doctor too. I still don't know why. I hate yogurt. It's just stuff
        with bits in. It's art! A statement on modern society, 'Oh Ain't Modern
        Society Awful?'! I am the Doctor, and you are the Daleks!
      </p>
      <h3>Planet of the Dead</h3>
      <p>
        Aw, you're all Mr. Grumpy Face today. You've swallowed a planet! The way
        I see it, every life is a pile of good things and bad
        things.&hellip;hey.&hellip;the good things don't always soften the bad
        things; but vice-versa the bad things don't necessarily spoil the good
        things and make them unimportant. You hate me; you want to kill me!
        Well, go on! Kill me! KILL ME! Annihilate? No. No violence. I won't
        stand for it. Not now, not ever, do you understand me?! I'm the Doctor,
        the Oncoming Storm - and you basically meant beat them in a football
        match, didn't you? It's art! A statement on modern society, 'Oh Ain't
        Modern Society Awful?'!
      </p>
      <h4>The Waters of Mars</h4>
      <p>
        The way I see it, every life is a pile of good things and bad
        things.&hellip;hey.&hellip;the good things don't always soften the bad
        things; but vice-versa the bad things don't necessarily spoil the good
        things and make them unimportant. You hit me with a cricket bat.
        Heh-haa! Super squeaky bum time! Stop talking, brain thinking. Hush. I'm
        the Doctor, I'm worse than everyone's aunt. *catches himself* And that
        is not how I'm introducing myself.
      </p>
      <h5>The Stolen Earth</h5>
      <p>
        Heh-haa! Super squeaky bum time! You hate me; you want to kill me! Well,
        go on! Kill me! KILL ME! You hate me; you want to kill me! Well, go on!
        Kill me! KILL ME! It's a fez. I wear a fez now. Fezes are cool.
      </p>
      <h6>Amy's Choice</h6>
      <p>
        I'm the Doctor. Well, they call me the Doctor. I don't know why. I call
        me the Doctor too. I still don't know why. Heh-haa! Super squeaky bum
        time! Did I mention we have comfy chairs? I'm the Doctor, I'm worse than
        everyone's aunt. *catches himself* And that is not how I'm introducing
        myself.
      </p>
    </article>
    <!-- /post -->
  </div>
  <!-- /main -->

  <aside role="complimentary">
    <h2>
      <a href="http://twitter.com/genelocklin" title="follow gene locklin"
        >Follow me on Twitter</a
      >
    </h2>
    <p>
      <a
        href="https://twitter.com/share"
        class="twitter-share-button"
        data-size="large"
        data-via="genelocklin"
        data-count="none"
        >Tweet</a
      >
      <a
        href="https://twitter.com/genelocklin"
        class="twitter-follow-button"
        data-show-count="false"
        data-size="large"
        >Follow @genelocklin</a
      >
    </p>
    <p>
      Father Christmas. Santa Claus. Or as I've always known him: Jeff. I'm the
      Doctor. Well, they call me the Doctor. I don't know why. I call me the
      Doctor too. I still don't know why. I hate yogurt. It's just stuff with
      bits in. It's art! A statement on modern society, 'Oh Ain't Modern Society
      Awful?'! I am the Doctor, and you are the Daleks!
    </p>
    <p>
      Aw, you're all Mr. Grumpy Face today. You've swallowed a planet! The way I
      see it, every life is a pile of good things and bad
      things.&hellip;hey.&hellip;the good things don't always soften the bad
      things; but vice-versa the bad things don't necessarily spoil the good
      things and make them unimportant. You hate me; you want to kill me! Well,
      go on! Kill me! KILL ME! Annihilate? No. No violence. I won't stand for
      it. Not now, not ever, do you understand me?! I'm the Doctor, the Oncoming
      Storm - and you basically meant beat them in a football match, didn't you?
      It's art! A statement on modern society, 'Oh Ain't Modern Society Awful?'!
    </p>
  </aside>
</div>
<!-- /wrap -->

              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css?family=Bitter:400, 700");

$dark: #252525;
$blue: #263347;
$white: #f6f6f6;
$green: #7db067;
$blueWhite: #edeff4;
$backgroundImage: url(http://f.cl.ly/items/0G3l1S3d0K39232G0p1W/generated.png) 0
  0 repeat;

@mixin hidden {
  display: none;
  visibility: hidden;
}
@mixin visible {
  display: block;
  visibility: visible;
}
@mixin visuallyhidden {
  border: 0;
  clip: rect(0 0 0 0);
  height: 1px;
  width: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
}
/*-------------------------------------------------------*/

* {
  margin: 0;
  padding: 0;
  border: 0;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

body {
  font: {
    family: "Bitter", sans-serif;
    weight: normal;
    size: 100%;
  }
  line-height: 1.5em;
  color: lighten($dark, 15%);
  background: $dark $backgroundImage;
  text-shadow: 0 -1px 0 rgba(255, 255, 255, 0.5);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font: {
    family: "Bitter", serif;
    weight: normal;
  }
  color: darken($dark, 7.5%);
}
h1 {
  font-size: 1.5em;
  line-height: 1em;
  margin: 1em 0;
}
h2,
h3 {
  font-size: 1.25em;
  line-height: 1.2em;
  margin: 1.2em 0;
}
h4,
h5,
h6 {
  font-size: 1em;
  line-height: 1.5em;
  margin: 1.5em 0;
}
p {
  margin: 0 0 1.5em 0;
  color: lighten($dark, 30%);
  -webkit-hyphens: auto;
  -moz-hyphens: auto;
  -ms-hyphens: auto;
  -o-hyphens: auto;
  hyphens: auto;
}

a {
  text-decoration: none;
  color: #fff;
  text-shadow: none;
  &:hover {
    border-bottom: 2px solid;
  }
}

#wrap {
  max-width: 960px;
  width: 90%;
  margin: 3em auto;
  background: $blueWhite $backgroundImage;
  overflow: hidden;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

[role="banner"] {
  width: 100%;
  background: $blue $backgroundImage;
  padding: 3em 2.5%;
  & h1 {
    color: #fff;
    text-shadow: none;
    line-height: 1;
    margin: 0;
  }
  & a {
    text-decoration: none;
    color: #fff;
    text-shadow: none;
    &:hover {
      border-bottom: 2px solid;
    }
  }
}

nav {
  height: 2em;
  width: 100%;
  background: $green $backgroundImage;
}

[role="main"] {
  width: 60%;
  float: left;
  z-index: 10;
  background: $white $backgroundImage;
  height: 100%;
  padding: 0 2.5%;
  margin-top: -1.5em;
  border-right: 1px solid lighten($dark, 75%);
  & h1:first-child {
    margin: 2em 0;
  }
  & p:first-of-type {
    color: #000;
  }
}

[role="complimentary"] {
  width: 40%;
  float: right;
  padding: 0 2.5%;
  & p {
    font-size: 0.875em;
    line-height: 1.714286em;
    margin-bottom: 1.714286em;
  }
  & h2 {
    margin: 1.2em 0 2.4em 0;
    & a {
      color: $blue;
      text-decoration: none;
      &:hover {
        border-bottom: 2px solid $blue;
      }
    }
  }
}

input[type="checkbox"] {
  @include visuallyhidden;
}

[for="width_sidebar"] {
  border-right: 1px solid lighten($dark, 75%);
  border-bottom: 1px solid lighten($dark, 75%);
  display: inline;
  border-radius: 0 0 5px 0;
  float: left;
  margin-left: 59.9%;
  position: relative;
  top: 0;
  width: 5%;
  height: auto;
  background: $white $backgroundImage;
  text-align: center;
  color: lighten($dark, 60%);
  line-height: 1.5em;
  &:hover ~ [role="main"] {
    box-shadow: 0 10px 10px rgba(0, 0, 0, 0.1);
  }
  & span {
    &:nth-of-type(1) {
      @include visuallyhidden;
    }
    &:nth-of-type(3) {
      @include hidden;
    }
  }
}

input[type="checkbox"]:checked {
  & ~ [role="complimentary"] {
    width: 100% !important;
    margin-top: 1.2em;
  }
  & ~ [role="main"] {
    width: 100%;
    box-shadow: none;
  }
  & ~ [for="width_sidebar"] {
    border: none;
    margin: 0;
    float: right;
    & span {
      &:nth-of-type(3) {
        @include visible;
      }
      &:nth-of-type(2) {
        @include hidden;
      }
    }
  }
}

@media screen and (max-width: 804px) {
  [for="width_sidebar"] {
    margin-left: 59.7%;
  }
}

@media screen and (max-width: 550px) {
  html {
    font-size: 90%;
  }
  [role="complimentary"] {
    width: 100%;
    background: $blueWhite $backgroundImage;
    margin-top: 1.2em;
  }
  [role="main"] {
    width: 100%;
    margin-top: 0;
  }
  [for="width_sidebar"] {
    @include visuallyhidden;
  }
}

              
            
!

JS

              
                
              
            
!
999px

Console