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

              
                <ul class="Words">
  <li class="Words-line">
    <p>&nbsp;</p>
    <p>CSS Only</p>
  </li>
  <li class="Words-line">
    <p>CSS Only</p>
    <p>Perspective</p>
  </li>
  <li class="Words-line">
    <p>Perspective</p>
    <p>Text Effect</p>
  </li>
  <li class="Words-line">
    <p>Text Effect</p>
    <p>by</p>
  </li>
  <li class="Words-line">
    <p>by</p>
    <p>James</p>
  </li>
  <li class="Words-line">
    <p>James</p>
    <p>Bosworth</p>
  </li>
  <li class="Words-line">
    <p>Bosworth</p>
    <p>&nbsp;</p>
  </li>
</ul>
              
            
!

CSS

              
                /* 
** Change this if you need to modify
** the amount of lines displayed
*/
$total-lines: 6;


/*
** Leave these unless you want
** to open a whole can of worms
*/
$left-offset: 29px;
$clip-height: 50px;
$line-height: $clip-height - 5px;


/*
** Set up the experiment
*/
html {
  background-color: #5138BE;
  height: 100%;
}

body {
  color: #FFFFFF;
  display: flex;
}


/*
** Apply styles to the parent element
*/
.Words {
  margin: 0 auto;
  padding: 80px 0;
  font-family: 'Source Sans Pro', Helvetica, Arial, sans-serif;
  font-size: 68px;
  font-weight: 900;
  letter-spacing: -2px;
  text-transform: uppercase;
  // Sort out nasty text fuzz
  transform: translate3d(0, 0, 0);
  -webkit-font-smoothing: antialiased;
  -webkit-font-kerning: normal;
  -webkit-text-size-adjust: 100%;
}


/*
** Apply common styles to each line of text
*/
.Words-line {
  height: $clip-height;
  overflow: hidden;
  position: relative;
  
  // Change the perspective of each alternating line
  &:nth-child(odd) {
    transform: skew(60deg, -30deg) scaleY(.66667);
  }
  &:nth-child(even) {
    transform: skew(0deg, -30deg) scaleY(1.33333);
  }
  
  // Loop over the total lines and apply a left offset
  @for $i from 1 through $total-lines+1 {
    &:nth-child(#{$i}) {
      left: $left-offset * $i;
    }
  }
}


/*
** Fine-grained text styles
*/
p {
  height: $clip-height;
  line-height: $line-height;
  padding: 0 10px;
  transition: all .4s ease-in-out;
  transform: translate3d(0, 0, 0);
  vertical-align: top;
  white-space: nowrap;
}


/*
** The hover interaction
*/
.Words:hover {
  p {
    transform: translate3d(0, -($clip-height), 0);
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console