cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <!-- The parent component of the curtain -->
<div class="curtain">
  <!-- The component wrapper -->
  <div class="curtain__wrapper">
    <!-- The checkbox, used for styling purposes -->
    <input type="checkbox" checked>
    <!-- The left curtain panel -->
    <div class="curtain__panel curtain__panel--left">
      <!-- The left portion of text -->
      <h1>Click to reveal&nbsp;</h1>
    </div> <!-- curtain__panel -->
    <!-- Inner content -->
    <div class="curtain__content">
      <!-- SVG trophy icon -->
      <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/9632/trophy.svg">
      <!-- Inner announcement -->
      <h2>Achievement Unlocked!</h2>
    </div>
    <!-- The right curtain panel -->
    <div class="curtain__panel curtain__panel--right">
      <h1>a special reward...</h1>
    </div> <!-- curtain__panel -->
  </div> <!-- curtain__wrapper -->
</div> <!-- curtain -->


            
          
!
            
              @import url('https://fonts.googleapis.com/css?family=Roboto+Slab');

body {
  font-family: 'Roboto Slab', serif;
}

.curtain {
  margin: 0 auto;
  width: 100%; /* Ensures the component is the full screen width */
  height: 100vh; /* Used for demo purposes */
  overflow: hidden; /* Allows us to slide the panels outside the container without them showing */
  
  &__wrapper {
    width: 100%;
    height: 100%;
    
    input[type=checkbox] {
      position: absolute; /* Force the checkbox at the start of the container */
      cursor: pointer; /* Indicate the curtain is clickable */
      width: 100%; /* The checkbox is as wide as the component */
      height: 100%; /* The checkbox is as tall as the component */
      z-index: 100; /* Make sure the checkbox is on top of everything else */
      opacity: 0; /* Hide the checkbox */
      top: 0;
      left: 0;
      
      // When the checkbox is checked...
      &:checked {
        
        // Slide the first panel out
        &~div.curtain__panel--left {
          transform: translateX(0);
        }
        
        // Slide the second panel out
        &~div.curtain__panel--right {
          transform: translateX(0);
        }
      }
    }
  }
  
  &__panel {
    display: flex;
    align-items: center;
    background: #00D7DF;
    color: #fff;
    float: left; /* Makes sure panels are side-by-side */
    position: relative; /* Needed to define the z-index */
    width: 50%; /* Each panel takes up half the container */
    height: 100vh; /* Used for demo purposes */
    transition: all 1s ease-out; /* Animates the sliding transition */
    z-index: 2; /* Places the panels in front of the prize */
    &--left {
      justify-content: flex-end;
      transform: translateX(-100%);
    }
    &--right {
      justify-content: flex-start;
      transform: translateX(100%);
    }
  }
  
  &__content {
    background: #333;
    color: #fff;
    padding: 1rem 0;
    position: absolute;
    text-align: center;
    z-index: 1;
    width: 100%;
    
    img {
      width: 20%;
    }
  }

}
            
          
!
999px
Loading ..................

Console