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

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.

HTML

              
                <div class="card">
  <div class="content">
    <h2>Final result <span class="pointing-index">☞</span></h2>
    <p>
      Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
    </p>
  </div>
  <div class="diagonal-text">
    <span>Hi, I'm diagonal</span>
  </div>
</div>

<div class="card card-show">
  <div class="content">
    <h2><span class="pointing-index">☞</span> Hover to animate</h2>
    <p>
      Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
    </p>
  </div>
  <div class="diagonal-text">
    <span>Hi, I'm diagonal</span>
  </div>
</div>
              
            
!

CSS

              
                * {
  box-sizing: border-box;
}

body {
  background: #d1d2d3;
  color: #2d2d2d;
  padding: 3rem;
  line-height: 1.5;
}

.pointing-index {
  font-size: 150%;
  position: relative;
  top: 4px;
}

.card {
  position: relative;
  width: 400px;
  background: white;
  margin: 0 auto;
  padding: 2rem 3rem;
  border-radius: 0.5rem;
  overflow: hidden;
  margin-bottom: 4rem;
}

.diagonal-text {
  position: absolute;
  top: 0;
  right: 0;
  display: inline-block;
  transform: translateX(50%) translateY(-50%) rotate(45deg);
  transform-origin: center;
  z-index: 1;
}

.diagonal-text::before {
  content: "";
  display: block;
  height: 0;
  padding-top: 100%;
}

.diagonal-text > span {
  display: inline-block;
  background: #eb8c00;
  padding: 6px 45px;
  transform: translateY(-50%);
  font-size: 18px;
  text-align: center;
  color: white;
  white-space: nowrap;
}

// CSS for animated card

.card-show {
  * {
    transition: all 0.75s;
  }

  .diagonal-text {
    background: rgba(0, 0, 0, 0.36);
    transform: none;

    > span {
      transform: none;
    }
  }

  &:hover {
    overflow: visible;
    animation: 1s overflow 1.75s forwards;

    .diagonal-text {
      background: transparent;
      transform: translateX(50%) translateY(-50%) rotate(45deg);

      > span {
        transform: translateY(-50%);
        transition-delay: 1.12s;
        animation: 0.5s letterspacing 3s alternate;
        animation-iteration-count: 2;
      }
    }
  }
}

@keyframes overflow {
  from {
    overflow: visible;
  }
  to {
    overflow: hidden;
  }
}

@keyframes letterspacing {
  0% {
    letter-spacing: initial;
  }
  50% {
    letter-spacing: 3px;
  }
  100% {
    letter-spacing: initial;
  }
}

              
            
!

JS

              
                
              
            
!
999px

Console