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="wrapper">
  <div class="content">
    <h1>Fade away text</h1>

    <p>Hover over me to reveal the rest. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Tempora doloremque facere quis, molestias dicta! Quidem ullam, dolore assumenda, iste laborum debitis inventore sequi magnam eos tempore recusandae laudantium dignissimos voluptates.Perferendis illo eius provident rem consequatur, sequi eos nulla sit nihil alias sapiente, dolorum natus laboriosam harum consectetur maxime facilis, ipsam commodi.</p>
  </div>
</div>
              
            
!

CSS

              
                @mixin fadeText($text-color, $direction : top, $offset : 2em, $transition: 0.5s ease-out) {  
  // text-color : dark
  $color: #fff;

  // direction : top
  $deg: 180deg;
  $pos: bottom;
  
  @if($text-color == 'light') {
    $color: #000;
    mix-blend-mode: screen;
  } @else {
    mix-blend-mode: multiply;
  }
  
  @if($direction == 'left') {
    $deg: 90deg;
    $pos: right;
  } @elseif ($direction == 'right') {
    $deg: -90deg;
    $pos: left;
  } @elseif ($direction == 'bottom') {
    $deg: 0deg;
    $pos: top;
  }
  
  position: relative;

  &::after {
    background: linear-gradient($deg, transparent, $color $offset) no-repeat $pos center / 100% 100%;
    
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    pointer-events: none;
    transition: $transition;
  }
  
  &:hover::after {
    @if($direction == 'left' or $direction == 'right') {
      background-size: 0% 100%;  
    } @else {
      background-size: 100% 0%;
    }
  }
  
}

// Your text color should have good contrast (either very light or very dark, with the appropriate option passed above) or the entire block will start turning transparent

p {
  color: #fff;
  @supports(mix-blend-mode: screen){
     @include fadeText(light, top, 3rem);
  } 
}

/* Pen styling */
// This was on <body> but then it mysteriously broke on Chrome
.wrapper {
  background: #222 url(https://source.unsplash.com/yNGQ830uFB4/1600x900) 50% 50% / cover;
  display: flex;
  align-items: center;
  font: 18px/1.5 'Roboto', sans-serif;
  justify-content: center;
  min-height: 100vh;
  position: relative;
  
  &::before {
    background: #222;
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    opacity: 0.5;
  }
}

h1 {
  font-size: 32px;
  font-weight: 300;
}

.content {
  color: #fff;
  max-width: 600px;
  text-align: center;
  position: relative;
}

              
            
!

JS

              
                
              
            
!
999px

Console