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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                <input type='checkbox' class="invis" id='open_close' />
<input type='radio' name='opts' class="invis" id='opt1' />
<input type='radio' name='opts' class="invis" id='opt2' />
<input type='radio' name='opts' class="invis" id='opt3' />

<header class="header-base">
  <h1 class="header__title">CSS Only 'cause let's be clever or something?</h1>

  <p>
    Choose an Option
  </p>

  <div class="select-area">
    <label for="open_close" class="input-select">
      <!--  Make a Selection  –– label is generated by css content -->
    </label>

    <ul class="select-options">
      <li>
        <label for="opt1">Option 1</label>
      </li>
      <li>
        <label for="opt2">Option 2</label>
      </li>
      <li>
        <label for="opt3">Option 3</label>
      </li>
    </ul>
  </div>
</header>

<main role="main" class="main-content">

  <section class="options opt1">
    <div class="content">
      <h1>Option 1</h1>
      <p>
        You chose Option 1. That's super great.
      </p>
      <p>
        I hope this works out well for you.
      </p>
      <p>
        Strip steak short ribs swine ham hock, pork belly t-bone pork turducken filet mignon pancetta brisket jerky beef ribs tenderloin porchetta. Short ribs venison brisket doner, swine pancetta kielbasa turkey pig boudin spare ribs ham frankfurter. Rump kevin flank filet mignon short ribs tail pastrami meatloaf.
      </p>
      <p>
        Venison corned beef ham ribeye. Flank pig filet mignon tri-tip tenderloin ham tail salami spare ribs meatball tongue. Kielbasa strip steak pork belly jerky chuck tail capicola filet mignon meatloaf salami frankfurter boudin tongue ball tip corned beef.
      </p>
    </div>
  </section>


  <section class="options opt2">
    <div class="content">
      <h1>Option 2</h1>
      <p>
        You chose Option 2.
      </p>
      <p>
        Second best is alright I suppose.
      </p>
      <p>
        Strip steak short ribs swine ham hock, pork belly t-bone pork turducken filet mignon pancetta brisket jerky beef ribs tenderloin porchetta. Short ribs venison brisket doner, swine pancetta kielbasa turkey pig boudin spare ribs ham frankfurter. Rump kevin flank filet mignon short ribs tail pastrami meatloaf.
      </p>
      <p>
        Venison corned beef ham ribeye. Flank pig filet mignon tri-tip tenderloin ham tail salami spare ribs meatball tongue. Kielbasa strip steak pork belly jerky chuck tail capicola filet mignon meatloaf salami frankfurter boudin tongue ball tip corned beef.
      </p>
    </div>
  </section>


  <section class="options opt3">
    <div class="content">
      <h1>Option 3</h1>
      <p>
        You chose Option 3.
      </p>
      <p>
        This is probably the least desirable option.
        It's number 3 for a reason y'all.
      </p>
      <p>
        Strip steak short ribs swine ham hock, pork belly t-bone pork turducken filet mignon pancetta brisket jerky beef ribs tenderloin porchetta. Short ribs venison brisket doner, swine pancetta kielbasa turkey pig boudin spare ribs ham frankfurter. Rump kevin flank filet mignon short ribs tail pastrami meatloaf.
      </p>
      <p>
        Venison corned beef ham ribeye. Flank pig filet mignon tri-tip tenderloin ham tail salami spare ribs meatball tongue. Kielbasa strip steak pork belly jerky chuck tail capicola filet mignon meatloaf salami frankfurter boudin tongue ball tip corned beef.
      </p>
    </div>
  </section>

</main>
              
            
!

CSS

              
                /*
  shared from the JS examples
*/
*, *:before, *:after {
  box-sizing: border-box;
  font-family: arial;
}

html, body, main, .jqueryOptions {
  height: 100%;
}

body {
  background: #eaeaea;
  font-size: 20px;
  margin: 0;
  padding: 0;
}

h1, h2, h3, p {
  margin-top: 0;
}

.content {
  margin: auto;
  max-width: 80%;
  padding: 20px;
}

.content :last-child {
  margin-bottom: 0;
}

.header-base {
  background: #eee;
  border-bottom: 1px solid #ddd;
  height: 100%;
  left: 0;
  padding: 20px;
  position: fixed;
  top: 0;
  width: 320px;
  z-index: 3;
}

.header__title {
  font-size: 1.3em;
}

.main-content {
  padding-left: 320px;
}

.footer-base {
  background: #dadada;
  bottom: 0;
  font-size: .55em;
  left: 0;
  position: fixed;
  text-align: center;
  width: 100%;
}


.select-area:after {
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 10px solid #444;
  bottom: 0;
  content: '';
  height: 0;
  margin: auto;
  pointer-events: none;
  position: absolute;
  right: 8px;
  top: 0;
}

.select-area {
  background-color: #fff;
  border: 1px solid #ccc;
  margin-bottom: 16px;
  padding: 8px 4px;
  position: relative;
}

.input-label {
  cursor: pointer;
  display: inline-block;
  margin-bottom: 8px;
}

.input-select {
  -webkit-appearance: textarea;
  -moz-appearance: window;
  background: none;
  border: 0;
  font-size: .8em;
  font-weight: 300;
  line-height: 1.33333;
  margin: 0;
  overflow: hidden;
  padding-right: 28px;
  padding: 0;
  text-overflow: ellipsis;
  width: 100%;
  width: 110% \9;
  z-index: 2;
}

.options {
  height: 0% ;
  overflow: auto;
  transition: all .3s;
  visibility: hidden;
}

.jqueryOptions:before,
.options:before {
  content: '';
  display: block;
  height: 100%;
  position: fixed;
  right: 0;
  top: 0;
  transform: translateY(100%);
  width: 100%;
  z-index: -1;
}

.current-opt:before,
.options:before {
  transform: translateY(0%);
}

.opt1 {
  background: #d6f2e0;
}

.opt1:before {
  background: #d6f2e0;
}

.opt2 {
  background: #d6eff2;
}

.opt2:before {
  background: #d6eff2;
}

.opt3 {
  background: #f2e6d6;
}

.opt3:before {
  background: #f2e6d6;
}

.show {
  display: block;
  height: 100%;
  /*overflow: visible;*/
  position: relative;
  visibility: visible;
}



@media screen and (max-width: 768px) {
  body {
    font-size: 16px;
  }

  .content {
    max-width: 100%;
  }
}


/*
  CSS for CSS Only version
*/
.select-area .select-options {
  display: block;
  opacity: 0;
  transition: .1s opacity;
  visibility: hidden;
}

#open_close:focus ~ .header-base .input-select {
  outline: 1px dotted;
}

#opt1:focus ~ .header-base label[for='opt1'],
#opt2:focus ~ .header-base label[for='opt2'],
#opt3:focus ~ .header-base label[for='opt3'] {
  outline: 1px dotted;
}

.input-select:before {
  content: 'Make a Selection';
}

#opt1:checked ~ .header-base .input-select:before {
  content: 'Option 1';
}

#opt2:checked ~ .header-base .input-select:before {
  content: 'Option 2';
}

#opt3:checked ~ .header-base .input-select:before {
  content: 'Option 3';
}

#open_close ~ input[name='opts'] {
  display: none;
}

#open_close:checked ~ input[name='opts'] {
  display: inline;
}

#open_close:checked ~ .header-base .select-area .select-options {
  opacity: 1;
  visibility: visible;
}

#open_close:checked ~ .header-base .select-area:after {
  border: none;
  content: 'X';
  top: -24px;
}

label {
  cursor: pointer;
  display: block;
}

label:hover {
  background: #ddd;
}

.select-options {
  background: #fefefe;
  border: 1px solid #ccc;
  box-shadow: 0 0 2px rgba(0,0,0,.2);
  box-sizing: padding-box;
  font-size: .8em;
  height: auto;
  left: 0;
  list-style: none;
  margin: auto;
  padding: 0;
  position: absolute;
  right: 0;
  top: 94%;
  width: 98%;
  z-index: 3;
}

.select-options li {
  padding: 4px;
}

.select-options label {
  cursor: pointer;
  display: block;
}

#opt1:checked ~ main .opt1,
#opt2:checked ~ main .opt2,
#opt3:checked ~ main .opt3 {
  display: block;
  height: 100%;
  visibility: visible;
}

.invis {
  height: 1px;
  clip: rect(0, 0, 0, 0);
  opacity: 0;
  position: absolute;
  width: 1px;
}
              
            
!

JS

              
                // no js required
              
            
!
999px

Console