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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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="bannerContainer">
    <div class="banner banner1">
      <div class="dragMe">^</div>
    </div>
  </div>
  <div class="input colorInput">
    <div><input class="colorUpdateInput" placeholder="enter custom background color" /></div>
    <div><button class="colorUpdate">go</button></div>
  </div>
  <h1 class="backgroundTitle">background-blend-mode</h1>
  <div class="buttonContainer backgroundButtons">
    <button class="background multiply">multiply</button>
    <button class="background screen">screen</button>
    <button class="background overlay">overlay</button>
    <button class="background darken">darken</button>
    <button class="background lighten">lighten</button>
    <button class="background color-dodge">color-dodge</button>
    <button class="background color-burn">color-burn</button>
    <button class="background hard-light  active">hard-light</button>
    <button class="background soft-light">soft-light</button>
    <button class="background difference">difference</button>
    <button class="background exclusion">exclusion</button>
    <button class="background hue">hue</button>
    <button class="background color">color</button>
  </div>

  <div class="input backgroundInput">
    <div><input class="backgroundUpdateInput" placeholder="enter custom background url" /></div>
    <div><button class="urlUpdate">go</button></div>
  </div>

  <h1 class="mixTitle">mix-blend-mode</h1>
  <div class="buttonContainer mixButtons">
    <button class="mix multiply">multiply</button>
    <button class="mix screen">screen</button>
    <button class="mix overlay">overlay</button>
    <button class="mix darken">darken</button>
    <button class="mix lighten">lighten</button>
    <button class="mix color-dodge">color-dodge</button>
    <button class="mix color-burn">color-burn</button>
    <button class="mix hard-light">hard-light</button>
    <button class="mix soft-light">soft-light</button>
    <button class="mix difference">difference</button>
    <button class="mix exclusion">exclusion</button>
    <button class="mix hue active">hue</button>
    <button class="mix color">color</button>
  </div>
</div>
</div>
              
            
!

CSS

              
                html {
  background-color: white;
}

body {
  margin: 0;
}

.container {
  background: url(https://assets.codepen.io/489403/deniro.jpeg) no-repeat center
    center fixed;
  background-color: red;
  background-blend-mode: hard-light;
  justify-content: center;
  align-items: center;
  display: flex;
  height: 100vh;
  width: 100vw;
  color: white;
}

.bannerContainer {
  width: 100%;
  height: 100%;
  justify-content: flex-end;
  align-items: center;
  display: flex;
}

.banner {
  border: 1px solid yellow;
  justify-content: flex-start;
  align-items: right;
  display: flex;
  flex-direction: column;
  width: 20%;
  height: 100%;
  background: #002b65;
  font-family: "Lato", sans-serif;
  font-size: 0.9em;
  position: relative;
}

.banner1 {
  align-items: flex-end;
  mix-blend-mode: hue;
}

h1 {
  font-family: "Roboto";
}

.buttonContainer {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  // border: 2px solid red;
  height: 50%;
  width: 150px;
  position: absolute;
}

.mixButtons {
  right: 20px;
}

.backgroundButtons {
  left: 20px;
  align-items: flex-end;
}

button {
  height: 25px;
  width: 100px;
  border-radius: 11px;
  box-shadow: 2px 2px 10px;
  font-family: "Roboto";
  background: white;
  color: #0e1111;
}

input {
  font-family: "Roboto";
}

.active {
  background: #0e1111;
  color: white;
  border: 2px solid #0e1111;
  outline: none;
}

.dragMe {
  color: red;
  position: absolute;
  top: 45%;
  left: -62px;
  text-align: center;
  border-radius: 5px;
  font-size: 1vw;
  transform: rotate(-90deg);
  background: grey;
  z-index: 100;
  width: 120px;
  height: 20px;
}

.input {
  box-shadow: 2px 2px 10px black;
  position: absolute;
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 20px;
  width: 220px;
  left: 20px;
  border-radius: 20px;
  padding: 10px;
  background: white;

  div {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  input {
    width: 170px;
    border: none;
    border-bottom: 1px solid black;
    margin-left: 10px;

    &:active,
    &:focus {
      outline: none;
    }
  }
}

.colorInput {
  top: 20px;
}

.colorUpdate,
.urlUpdate {
  width: 30px;
  cursor: pointer;

  &:active,
  &:focus {
    outline: none;
  }
}

.backgroundInput {
  top: 80px;
}

input {
  margin-right: 10px;

  &:active {
    outline: none;
  }
}

.backgroundTitle {
  color: white;
  position: absolute;
  left: 30px;
  transform: rotate(-90deg);
}

.mixTitle {
  color: white;
  position: absolute;
  right: 90px;
  transform: rotate(90deg);
}

              
            
!

JS

              
                const filter = document.querySelector(".banner");
const filterContainer = document.querySelector(".container");

const bannerX = document.querySelector(".banner").offsetLeft;

interact(filter)
  .resizable({
    edges: {
      top: false,
      bottom: false,
      left: true,
      right: false
    }
  })
  .on("resizemove", (event) => {
    let { x, y } = event.target.dataset;
    x = parseFloat(x) || 0;
    y = parseFloat(y) || 0;

    Object.assign(event.target.style, {
      width: `${event.rect.width}px`,
      height: `${event.rect.height}px`,
      transform: `translate(${event.deltaRect.left}px, ${event.deltaRect.top}px)`
    });

    Object.assign(event.target.dataset, { x, y });
  });

const backgroundButtons = document.querySelectorAll(".background");

backgroundButtons.forEach((button) => {
  button.addEventListener("click", function (e) {
    e.preventDefault();

    filterContainer.style.backgroundBlendMode = button.classList[1];
    backgroundButtons.forEach((backgroundButton) =>
      backgroundButton.classList.remove("active")
    );
    button.classList.add("active");
  });
});

const mixButtons = document.querySelectorAll(".mix");

mixButtons.forEach((button) => {
  button.addEventListener("click", function (e) {
    e.preventDefault();

    filter.style.mixBlendMode = button.classList[1];
    mixButtons.forEach((mixButton) => mixButton.classList.remove("active"));
    button.classList.add("active");
  });
});

const colorUpdateButton = document.querySelector(".colorUpdate");
const colorUpdateInput = document.querySelector(".colorUpdateInput");

colorUpdateButton.addEventListener("click", function (e) {
  e.preventDefault();
  console.log(colorUpdateInput.value);
  filterContainer.style.backgroundColor = colorUpdateInput.value;
  colorUpdateInput.value = "";
});

const backgroundUpdateButton = document.querySelector(".urlUpdate");
const backgroundUpdateInput = document.querySelector(".backgroundUpdateInput");

backgroundUpdateButton.addEventListener("click", function (e) {
  e.preventDefault();

  filterContainer.style.background = `url(${backgroundUpdateInput.value})`;
  backgroundUpdateInput.value = "";
});

              
            
!
999px

Console