Edit on
<div class="wrapper" id="w">
  <div class="box" id="b"></div>
</div>

<input type="range" min="120" max="400" value="400" class="range" id="r">
<output>Width is: <span id="op">400px</span></output>
<output>Padding bottom on yellow box is:<br><span id="op2">10%</span></output>

<p>See <a href="http://www.sitepoint.com/12-little-known-css-facts/">article</a>.</p>
body {
  font-family: Arial, sans-serif;
  padding-top: 30px;
  text-align: center;
}

.wrapper {
  width: 400px;
  margin: 0 auto;
  border: solid 1px black;
}

.box {
  width: 100px;
  height: 100px;
  background: gold;
  margin-left: auto;
  margin-right: auto;
  padding-top: 10%;
  padding-bottom: 10%;
  margin-bottom: 5%;
}

.range {
  display: block;
  margin: 20px auto;
}

output {
  text-align: center;
  display: block;
  font-weight: bold;
  padding-bottom: 20px;
}

output span {
  font-weight: normal;
}
var cw = document.getElementById('w'),
    r = document.getElementById('r'),
    b = document.getElementById('b'),
    op = document.getElementById('op'),
    op2 = document.getElementById('op2');

r.onchange = function () {
  cw.style.width = this.value + 'px';
  op.innerHTML = this.value + 'px';
  op2.innerHTML = window.getComputedStyle(b, null).getPropertyValue('padding-top');
};
Rerun