<h1>Change underline thickness using the slider</h1>
<input type="range" max="20" step="1" value="3">

<output class="code-container"><span class="token-selector">h1</span> { <span class="token-property">text-decoration-thickness</span>: <span class="token-function">3px</span> }</output>
body {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

h1 {
  display: block;
  font-size: 2em;
  color: hsl(207, 90%, 54%);
  text-decoration: underline;
}

@supports not (text-decoration-thickness: 1px) {
  h1::after {    
    content: "Your browser doesn't support this property";
    display: block;
    color: #e43;
    margin-top: 15px;
    font-weight: bold;
    text-decoration: unset;
    font-size: 12px;
  }
}

input {
  width: 200px;
  margin: 4rem auto 2rem;
}

output {
  display: block;
}

.code-container {
  width: 375px;
  max-width: 100%;
  overflow-x: auto;
  text-align: center;
  background-color: #272822;
  padding: 1.5em 0;
  border-radius: 3px;
  color: #F8F8F2;
  text-shadow: 0 1px rgba(0, 0, 0, 0.3);
  font-family: Consolas, Monaco, 'Andale Mono', monospace;
}

.token-property {
  color: #F92672;
}

.token-function {
  color: #E6DB74;
  display: inline-block;  
  width: 40px;
 
}

.token-selector {
  color: #a6e22e;
}
var text = document.querySelector('h1'),
    slider = document.querySelector('input');

slider.addEventListener('input', function () {
  text.style.textDecorationThickness = this.value + 'px';
  document.querySelector('.token-function').textContent = this.value + 'px';
}, false);

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.