<button onClick="changeBackgroundSize('reduce')"> REDUCE - </button>
<button onClick="changeBackgroundSize('enlarge')">ENLARGE + </button>

<div class="dad">
  <div class="bg">
    <h1> contrast </h1>
    <h3 style="min-width: 300px;"> is <span class="white-text"> really </span> important </h3>
  </div>
</div>
body,
h1,
h3 {
  margin: 0;
  font-family: "Roboto", sans-serif;
  font-weight: 300;
  color: #4f4f4f;
  margin: 0;
  mix-blend-mode: color-dodge;
}

h1 {
  font-size: 8rem;
  line-height: 100%;
}

button {
  cursor: pointer;
  padding: 1rem;
  font-weight: 700;
  color: #666666;
  border-radius: 2rem;
  border: none;
  display: inline-block;
  width: 30vw;
  margin: 1rem;
  outline: none;
}

button:active {
  background-color: #9b51e0;
}

h3 {
  font-size: 2rem;
  line-height: 100%;
}

.dad {
  position: relative;
}

.white-text {
  color: white;
}

.bg {
  background-color: #333333;
  height: 100vh;
}
document.getElementsByClassName("bg")[0].style.maxWidth = "20%";

function changeBackgroundSize(param) {
  let background = document.getElementsByClassName("bg");
  let initialValue = Number(background[0].style.maxWidth.slice(0, -1));
  let result = "";

  if (param == "reduce") {
    result = initialValue - 10;
  }
  if (param == "enlarge") {
    result = initialValue + 10;
  }
  background[0].style.maxWidth = String(result) + "%";
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.