Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
72 lines (63 sloc) 1.52 KB
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<title>Scoped CSS Variables and JS</title>
<script src=""></script>
<div id="app">
<h2>Update CSS Variables with <span :style="spanStyle">JS</span></h2>
<div class="controls">
<label for="spacing">Spacing:</label>
<input id="spacing" type="range" min="10" max="200" v-model="spacing">
<label for="blur">Blur:</label>
<input id="blur" type="range" min="0" max="25" v-model="blur">
<label for="base">Base Color</label>
<input id="base" type="color" v-model="base">
<img src="" :style="imgStyle">
var app = new Vue({
el: '#app',
data: {
spacing: 10,
blur: 10,
base: "#ffc600"
computed: {
spanStyle: function() {
return { color: this.base }
imgStyle: function() {
return {
padding: `${this.spacing}px`,
background: this.base,
filter: `blur(${this.blur}px)`
misc styles, nothing to do with CSS variables
body {
text-align: center;
background: #193549;
color: white;
font-family: 'helvetica neue', sans-serif;
font-weight: 100;
font-size: 50px;
.controls {
margin-bottom: 50px;
input {