<form action="">
  <label>设置box样式:</label>
  <select id="key">
    <option value="" selected>选择属性名</option>
    <option value="overflow">overflow</option>
    <option value="overflowX">overflow-x</option>
    <option value="overflowY">overflow-y</option>
  </select>
  <select id="value">
    <option value="" selected>选择属性值</option>
    <option value="auto">auto</option>
    <option value="scroll">scroll</option>
    <option value="hidden">hidden</option>
    <option value="visible">visible</option>
    <option value="inherit">inherit</option>
  </select>
</form>
<div id="box">
  <div class="ele"></div>
</div>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  width: 100vw;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

#box {
  width: 300px;
  height: 300px;
  border: 1px solid #eee;
  margin-top: 20px;
  border-radius: 4px;
  box-shadow: 0 0 1px rgba(0,0,0,.4);
  padding: 5px;
}

.ele {
  width: 50vw;
  height: 50vw;
  background: 
    linear-gradient(rgba(255,255,255, .6) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255, .6) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255, .6) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255, .6) 1px, transparent 1px),
    linear-gradient(135deg, rgba(84,232,220,1) 0%,rgba(241,231,103,1) 25%,rgba(240,229,104,1) 50%,rgba(254,182,69,1) 75%,rgba(250,118,47,1) 100%);
  background-size: 20px 20px, 20px 20px, 20px 20px, 20px 20px, 100% 100%;
  background-blend-mode: hard-light, overlay, screen, saturation;
}
const keyDom = document.querySelector('#key')
const valueDom = document.querySelector('#value')
const boxDom = document.querySelector('#box')

let key, value
keyDom.addEventListener('change',()=>{
  key = keyDom.value
  setStyle()
})

valueDom.addEventListener('change',()=>{
  value = valueDom.value
  setStyle()
})
function setStyle() {
  boxDom.style = {}
  boxDom.style[key] = value
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.