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

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.

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="masked-element">
  <div class="masked-element--background image"></div>
    <!-- Make sure the data-heading value matches the visible text of the H1 -->
<h1 class="masked-element--clipped-text" data-heading="Morning, mist, and magic" contenteditable="true">Morning, mist, and magic</h1>
</div>

<div class="masked-element black">
<div class="masked-element--background color">
</div>
    <!-- Make sure the data-heading value matches the visible text of the H1 -->
<h1 class="masked-element--clipped-text skinny" data-heading="Just a bit of drama" contenteditable="true">Just a bit of drama</h1>
</div>
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css2?family=Hepta+Slab:[email protected]&display=swap");

:root {
    /* Change the mask shape and text colors here */
--mask-shape: ellipse(200% 90% at -20% 0%);
  --text-color: #004360;
  --text-overlay-color: #ffffff;
}

body {
  margin: 0;
  padding: 0;
}

h1 {
  font-family: "Hepta Slab", Helvetica, sans-serif;
  font-size: calc(5vw + 1em);
  font-weight: 900;
}

.skinny {
  font-family: "Hepta Slab";
  font-size: calc(7.25vw + 1em);
  font-weight: 1;
}

.black {
  --text-color: #000000;
}

.masked-element {
  height: 80vh;
  margin-bottom: 4rem;
  max-height: 95vh;
  position: relative;
}

.masked-element--background {
  -webkit-clip-path: var(--mask-shape);
  clip-path: var(--mask-shape);
  position: relative;
  height: 100%;
  width: 100%;
  z-index: 1;
}

.masked-element--background.image {
  background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/57225/mist_crop.jpg);
  background-size: cover;
}

.masked-element--background.color {
  background-color: var(--text-color);
}

.masked-element--clipped-text {
  color: var(--text-color);
  line-height: 1.1;
  margin: 0;
  padding: 0 1rem 0 0;
  height: 100%;
  width: 100%;
  position: absolute;
  bottom: 0;
  right: 0;
  display: flex;
  flex-direction: row-reverse;
  align-items: flex-end;
  text-align: right;
  z-index: 2;
  &:after {
    content: attr(data-heading);
    color: var(--text-overlay-color);
    -webkit-clip-path: var(--mask-shape);
    clip-path: var(--mask-shape);
    margin: inherit;
    padding: inherit;
    height: inherit;
    width: inherit;
    position: inherit;
    bottom: inherit;
    right: inherit;
    display: inherit;
    flex-direction: inherit;
    align-items: inherit;
    text-align: inherit;
    z-index: 3;
  }
}

.background-color {
  background-color: var(--text-color);
}
              
            
!

JS

              
                // JS for content editable trick from Chris Coyier

var h1s = [].slice.call(document.querySelectorAll('h1'));

h1s.forEach(h1 => h1.addEventListener("input", updateText));


function updateText(e) {
  this.setAttribute("data-heading", this.innerText);
}
              
            
!
999px

Console