Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's 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 it's URL and the proper URL extention.

+ 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="container">
  <div class="header">
    <div class="clipped">
      <h1 id="title">Title</h1>
    </div>
  </div>
  <content>
    <h2>This is a subtitle</h2>
    <hr>
    <p>Since a previous update of Google Chrome, this effect is not working anymore like before. I used 'text-fill-color' together with 'background-clip'. Now I changed it to 'mix-blend-mode'. This is alot easier in my opinion. You can still find the "old" version commented out in the CSS.</p>
  </content>
</div>

<div class="upload">
  <input name="titleInput" 
         type="text" 
         placeholder="Enter title">
  <button id="uploadButton">
    Upload image
  </button>
  <input id="uploadFile"
         type="file"
         name="image"
         class="img"
         value="Upload image">
</div>
</div>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Playfair+Display:900|Raleway:300,800');
*{margin: 0;padding: 0;box-sizing: border-box;-webkit-box-sizing: border-box;-moz-box-sizing: border-box;overflow-x: hidden;}

body{
  background-image: linear-gradient(to top, #09203f 0%, #537895 100%);
  min-height:100vh;
  display:flex;
  justify-content:center;
}

.clipped {
  display:flex;
  align-items:flex-end;
  height:100%;
  line-height:1.2;
  overflow:hidden;
  background: url("https://www.w3schools.com/css/trolltunga.jpg") no-repeat #fff;
  background-size: cover;
  color: rgba(255,255,255,0.3);
  font-size: 2em;
  font-family: 'Playfair Display', serif;
  /*-webkit-text-fill-color:transparent;
  -webkit-background-clip: text;
  -webkit-filter: invert(100%) hue-rotate(0deg);
  
  change hue-rotate to play with tint */
}
#title{
  overflow:hidden;
  color:#fff;
  mix-blend-mode:difference;
  padding:30px calc(15% - 20px);
}
input {
  display: block;
}
.header {
  height: 250px;
  width: 100% - 10px;
  overflow: hidden;
  background: url("https://www.w3schools.com/css/trolltunga.jpg") no-repeat #fff;
  background-size: cover;
  margin:20px 20px 0 20px;
  border-radius:8px;
  box-shadow:2px 3px 20px 0 rgba(0,0,0,0.3);
}
.container {
  display: block;
  width: 100%;
  float: left;
  max-width:800px;
}
.upload {
  position:fixed;
  right:40px;
  top:40px;
  width: 20%;
  margin-left:10%;
  display: block;
  float: left;
  overflow:visible;
}
input[name=titleInput]{
  width:100%;
  height:50px;
  padding:10px 15px;
  margin-bottom:10px;
  font-size:.8em;
  font-family: 'Raleway', sans-serif;
  font-weight:300;
  border-radius:3px;
  border:0;
  box-shadow:2px 1px 10px 0 rgba(0,0,0,0.5);
}
#uploadFile{
  display:none;
}
#uploadButton{
  margin-bottom:20px;
  font-family: 'Raleway', sans-serif;
  font-weight:300;
  height:50px;
  width:100%;
  font-size:.8em;
  background-color:white;
  border-radius:3px;
  border:0;
  text-align:left;
  padding:10px 15px;
  box-shadow:2px 1px 10px 0 rgba(0,0,0,0.5);
}
content{
  display:block;
  padding:30px;
  color:#fff;
  opacity:.8;
  padding:30px 15%;
}
h2{
  font-size: 1.1em;
  font-family: 'Raleway', sans-serif;
  font-weight:800;
  letter-spacing:0.5pt;
}
hr{
  margin:10px 0 10px 0;
  width:30px;
  height:6px;
  background-color:#2980b9;
  border:0;
  text-align:left;
}
p{
  font-size: .9em;
  font-family: 'Raleway', sans-serif;
  font-weight:300;
  overflow:hidden;
}
              
            
!

JS

              
                // title from text input

/*
$('input[name=titleInput]').keyup(function(){
  $('.clipped').hide().show(0);
  $('#title').text(this.value);
});

$('.clipped').hide().show(0); starts an animation with duration 0 and uses requestAnimationFrame which triggers a redraw. To be sure that an update of jQuery won't break it, the code should be written like this:
*/

$('input[name=titleInput]').keyup(function(){
  if( window.requestAnimationFrame ) {
    $('.clipped').hide();
  }
  $('#title').text(this.value);
  if( window.requestAnimationFrame ) {
    window.requestAnimationFrame(function() {
      $('.clipped').show();
    })
  }
});

// image upload

$("#uploadButton").click(function(){
  $("#uploadFile").click();
});

$(document).ready(function(){
  ImageUpload.init();
});

var ImageUpload = {
  init:function() {
    $("#uploadFile").change(function(){
        ImageUpload.readURL(this);
    });
  },
  readURL:function(input) {
    if (input.files && input.files[0]) {
        var reader = new FileReader();
        reader.onload = function (e) {
          $('.header').css(
              "background-image",
              "url(" + e.target.result + ")"
            );
          $(".clipped").css(
            "background-image",
            "url(" + e.target.result + ")"
          );
        }
        reader.readAsDataURL(input.files[0]);
    }
  },
}

              
            
!
999px

Console