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="container" id="c-red" style="background-blend-mode: normal">
    <div class="menu">
      <span>Blend mode</span>
     
      <div class="menu__item">
     <ul id="blend">
      <li class="is--active">normal</li>
      <li>multiply</li>
      <li>overlay</li>
      <li>screen</li>
      <li>darken</li>
      <li>lighten</li>
      <li>color-dodge</li>
      <li>color-burn</li>
      <li>hard-light</li>
      <li>soft-light</li>
      <li>difference</li>
      <li>exclusion</li>
      <li>hue</li>
      <li>saturation</li>
      <li>color</li>
      <li>luminosity</li>
    </ul>
      </div>
  </div>
  

  <ul id="color">
    <li class='is--active'>red</li>
    <li>yellow</li>
    <li>green</li>
  </ul>
  
</div>

              
            
!

CSS

              
                * {
  box-sizing: border-box;
}

body, html {
  height: 100%;
  padding: 0;
  margin: 0;
}

body {
  font-family: 'Source Sans Pro', sans-serif;
}

.container {
  display: block;
  background-size: 100%;
  height: 100%;
  width: 100%px;
  padding: 20px;
  background: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/14179/image.jpg') no-repeat 0 0;
  border-top: 29px solid transparent;
  background-size: 100%;
  background-size: cover;
}

.menu {
  border: 3px solid #333;
  background-color: white;
  background-color: rgba(255,255,255,.8);
  display: inline-block;
  padding: 15px 15px 6px 15px;
  width: 200px;
  position: relative;
  height: 221px;

 
  span, ul {
    float: left;
  }
  
  span {
    clear: left;
    margin-right: 0;
    margin-bottom: 0;
    text-transform: uppercase;
    font-size: 16px;
    width: 100%;
    display: block;
    border-bottom: 2px solid black;
    margin-bottom: 10px;
  }
}

.menu__item {
  overflow: scroll;
  height: 165px;
  display: block;
  clear: both;
}

#color {
  position: absolute;
  top: 0;
  left: 20px;
  
  li {
    float: left;  
    margin-right: 0;
    text-transform: uppercase;
    padding: 6px 15px;
    border: none;
    
    &:hover,
    &:focus {
      padding: 6px 15px;
      border: none;
    }
    
    &.is--active {
      border: none;
      padding: 6px 15px;
      background-color: black;
      color: white;
    }
  }
}

select {
font-size: 18px;
}

ul {
  margin: 0;
  margin-bottom: 15px;
  padding: 0;
  list-style: none;
  
  li {
    pointer: cursor;
    font-size: 13px;
    padding: 5px 6px;
    border: 1px solid transparent;
    display: block;
    
    &:hover,
    &:focus {
      cursor: pointer;
      background-color: white;
    }
  }
}

.is--active {
  border: 1px dashed #aaa;
  background-color: white;
}

#c-red {
  background-color: #FF4136;
}

#c-yellow {
  background-color: #FFDC00;
}

#c-green {
  background-color: #09CD56;
}



              
            
!

JS

              
                var container = document.querySelector('.container'),
    blendMode = document.getElementById('blend'),
    color = document.getElementById('color');

blendMode.addEventListener('click', function(e) {
  if (e.target != e.currentTarget){
    var value = e.target.textContent;
    container.style.backgroundBlendMode = value;
    removeCurrentClasses(blendMode);
    e.target.classList.add('is--active');
  }
});


var removeCurrentClasses = function(parent){
    for (var i = 0; i < parent.children.length; i++){  
      parent.children[i].className = "";
    }
}

color.addEventListener('click', function(e){
  
  if(e.target != e.currentTarget) {
    var colorValue = e.target.textContent;
     removeCurrentClasses(color);
    e.target.className = "is--active";
    container.id = "c-" + colorValue;
  }
})





              
            
!
999px

Console