octocatstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Want a Run Button?

If active, the preview will update automatically when you change code.

            
              <html>
<head>
  <title>
    HTML Element Background Blending Gallery
  </title>
</head>
<body onload="load()">
  <div id="title">CSS Background Blending Modes</div>
  <div id="header">
    <label>Blend Mode: </label>
    <select id="blendModesList">
      <option value="normal">normal</option>
      <option value="multiply">multiply</option>
      <option value="screen">screen</option>
      <option value="overlay">overlay</option>
      <option value="darken">darken</option>
      <option value="lighten">lighten</option>
      <option value="color-dodge">color-dodge</option>
      <option value="color-burn">color-burn</option>
      <option value="hard-light">hard-light</option>
      <option value="soft-light">soft-light</option>
      <option value="difference">difference</option>
      <option value="exclusion">exclusion</option>
      <option value="hue">hue</option>
      <option value="saturation">saturation</option>
      <option value="color">color</option>
      <option value="luminosity">luminosity</option>
    </select>
    <label>Background color: </label>
    <input id="backgroundColorPicker" type="color" value='#4499f0'>
    <label>Background image: </label>
    <select id="backgroundImageList">
      <option value="http://farm6.staticflickr.com/5328/8959572482_2601c86c04_c.jpg">Waterfall</option>
      <option value="http://farm4.staticflickr.com/3694/8959572838_57fa40bdb4_c.jpg">Seaside</option>
      <option value="http://farm9.staticflickr.com/8266/8959572616_c47c510060_c.jpg">Sunset</option>
      <option value="http://farm8.staticflickr.com/7371/8958376607_b8c6586c4b_c.jpg">Bridge</option>
      <option value="http://farm8.staticflickr.com/7403/8958376269_d8b658fc2c_c.jpg">Mountains</option>
    </select>
  </div>
  <div id="wrapper"></div>
</body>
</html>

            
          
!
            
              body {
  font-family: Arial, Helvetica, sans-serif;
  background: lightgray;
}

#title {
  font-size: 150%;
  font-style: normal;
  line-height: 120%;
  font-weight: 700;
  margin: 15px 0px 10px 12px;
  padding: 10px 15px 8px 100px;
}

#header {
  padding: 10px 15px 8px 20px;
}

#wrapper {
  margin: 10px 15px 20px 20px;
  border-radius: 30px;
  width: 800px;
  height: 600px;
  background: url('http://farm6.staticflickr.com/5328/8959572482_2601c86c04_c.jpg') no-repeat center center fixed, rgba(0,55,99,1);
  -webkit-background-size: cover;
  background-size: cover;

  background-blend-mode: normal, normal;
  -webkit-background-blend-mode: normal, normal;
}

            
          
!
            
              function blendModeChanged() {
  var blendMode = document.getElementById("blendModesList").options[
    document.getElementById("blendModesList").selectedIndex].value;
  document.getElementById("wrapper").style.backgroundBlendMode = blendMode + ', normal';
  document.getElementById("wrapper").style.webkitBackgroundBlendMode = blendMode + ', normal';
}

function backgroundColorChanged() {
  var backgroundColor = document.getElementById("backgroundColorPicker").value;
  document.getElementById("wrapper").style.backgroundColor = backgroundColor;
}

function backgroundImageChanged() {
  var selectedImage = document.getElementById("backgroundImageList").options[
    document.getElementById("backgroundImageList").selectedIndex];

  var backgroundImage = selectedImage.value;
  document.getElementById("wrapper").style.backgroundImage = "url(" + backgroundImage + ")";
}

function load() {
  if (navigator.userAgent.indexOf('Chrome') === -1) {
    $("#backgroundColorPicker").spectrum(
      {color: "#f00",
       showButtons: false,
       change: function(color) {
         document.getElementById("wrapper").style.backgroundColor = color.toHexString();
       }});
  }
  document.getElementById("blendModesList").addEventListener("change", blendModeChanged, false);
  document.getElementById("backgroundColorPicker").addEventListener("change", backgroundColorChanged, false);
  document.getElementById("backgroundImageList").addEventListener("change", backgroundImageChanged, false);
}

            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console