cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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.

            
              <div class="flex">
  <div class="block">
    <a href="#" class="toggle"></a>
    <div class="small-box">
      <h1>Rogie King</h1>
    </div>
    <div class="content">
    <h2>Rogie King</h2>
    <p>Rogie King is an illustrator, designer, and programmer who lives and works in the big sky state of Montana. He is the founder of Komodo Media and shares his love of illustration and all things Disney on his blog. Rogie is keen on hot sauce, trance music, and Star Wars. He is hopelessly in love with his wife, Toni, and their two young boys. In their spare time, they like to laugh, go on outdoor adventures, and take road trips.</p>
    <img src="https://d13yacurqjgara.cloudfront.net/users/255/screenshots/683315/attachments/61523/rogie.png">
    </div>
  </div>
</div>
            
          
!
            
              * {
  box-sizing: border-box;
  
  &::before, &::after {
    box-sizing: border-box;
  }
}

@-webkit-keyframes fadein {
  from { opacity: 0; }
  to { opacity: 1; }
}


@keyframes fadein {
  from { opacity: 0; }
  to { opacity: 1; }
}


html {
  height: 100%;
  width: 100%;
}

body {
  height: 100%;
  width: 100%;
  padding: 0px;
  margin: 0;
  font-family: "Source Sans Pro", sans-serif;
  background: -webkit-linear-gradient(left, #aeffd5 0%, #b8faf2 100%);
  background: linear-gradient(to right, #aeffd5 0%, #b8faf2 100%);
}

h2 {
  margin-top: 0;
  font-weight: 400;
}

.flex {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.block {
  height: 200px;
  width: 200px;
  color: #FFF;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  text-align: center;
  line-height: 200px;
  font-size: 18px;
  position: relative;
  background: linear-gradient(to right, #644cad 0%, #4426a8 100%);
  box-shadow: 0px 7px 28px -1px rgba(0,0,0,0.75);  
  transition: 0.3s all ease;
  
  .small-box {
    opacity: 0;
    animation: fadein 2s forwards;
    animation-delay: 0.5s;
    display: flexx;
    justify-content: center;
    align-items: center;
    font-family: "Kaushan Script", cursive;
    
    h1 {
      margin: 0;
    }
  }
  
  &.expanded {
    transition: 0.3s all ease;
    width: 800px;
    height: 400px;
    padding: 40px;
    line-height: normal;
    background: #24252A;
    background: -webkit-linear-gradient(left, #644cad 0%, #4426a8 100%);
    background: linear-gradient(to right, #644cad 0%, #4426a8 100%);
    
    .small-box {
      display: none;
    }
  }
  
  .content {
    text-align: left;
    display: none;
    opacity: 0;
  
    h2 {
      font-family: "Kaushan Script", cursive;
    }
    
    p {
      line-height: 35px;
    }
    
    img {
      width: 300px;
      position: absolute;
      right: 0;
    }
    
    &.display {
      animation: fadein 2s forwards;
      animation-delay: 0.5s;
      display: block;
    }
  }
  
  a {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
  }
}

@media (max-width: 578px) {
  .block.expanded {
    height: 100%;
  }
  
  .block .content img {
    top: 0;
    right: 25px;
    width: 110px;
  }
}
            
          
!
            
              $(".toggle").click(function() {
  $(".block").toggleClass("expanded");
  $(".content").toggleClass("display");
});


// Created For Codepad.co
// https://codepad.co/snippet/MbG8hlQu


// Illustration - Rogie King
// https://dribbble.com/shots/683315-Avatar-Tweakage
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console