console
const inputs = document.querySelectorAll('.controls input');
function handleUpdate(){
const suffix = this.dataset.sizing || '';
document.documentElement.style.setProperty(`--${this.name}`,this.value + suffix)
document.getElementById(`code-${this.name}`).innerText = this.value+suffix;
}
inputs.forEach(input => input.addEventListener('change',handleUpdate))
inputs.forEach(input =>input.addEventListener('mousemove',handleUpdate));
<body>
<div class="controls">
<label for="spacing">Spacing:</label>
<input type="range" name="spacing" min="10" max="200" value="10" data-sizing="px">
<label for="blur">Blur:</label>
<input type="range" name="blur" min="0" max="25" value="10" data-sizing=“px”>
<label for="base">Base:</label>
<input type="color"name="base" value="#8aa8af">
<br>
<code class="result">
img {
padding: <label id="code-spacing">10px</label>;
filter: blur(<label id="code-blur">10px</label>);
background: <label id="code-base">#8aa8af</label>;
}
</code>
<img src="http://ofjku7mlm.bkt.clouddn.com/16-12-22/39048308-file_1482385934460_1316f.jpg">
</div>
</body>
:root{
--spacing:11px;
--blur:5px;
--base: #8aa8af;
}
img{
padding:var(--spacing);
background:var(--base);
filter:var(--blur)
}
body {
text-align: center;
}
body {
background: #193549;
color: white;
font-family: 'helvetica neue', sans-serif;
font-weight: 100;
font-size: 1.5em;
}
.controls {
margin-bottom: 1em;
}
input {
width:100px;
}