<form>
  <fieldset>  
    <label class="active">
      <input type="radio" name="class" value="container--one" class="radio" checked="checked">
      <code>0</code>
      <small>(default)</small>      
    </label>        
    <label>
      <input type="radio" name="class" value="container--two" class="radio">
      <code>0.5</code>
    </label>     
    <label>
      <input type="radio" name="class" value="container--three" class="radio">
      <code>1</code>
    </label>         
    <label>
      <input type="radio" name="class" value="container--four" class="radio">
      <code>2</code>
    </label>             
  </fieldset>  
</form>

<div class="container container--one" id="container">
  <p class="box box--one">
    <strong>Item 1<br>(styled)</strong>
  </p>
  <p class="box box--two">
    <strong>Item 2</strong>
  </p>
  <p class="box box--three">
    <strong>Item 3</strong>
  </p>  
</div>
.container--one .box--one {
  flex-grow: 0;
}

.container--two .box--one {
  flex-grow: 0.5;
}

.container--three .box--one {
  flex-grow: 1;
}

.container--four .box--one {
  flex-grow: 2;
}

.box--one {
  background: lightgrey;
}

/* ETC (Formatting only): */

body {
  margin: 1.5em;
  font-size: 130%;
  font-family: sans-serif;
}

.container {
  display: flex;  
  border: 5px solid black;
  padding: 0.25rem;
}

.container p {
  margin: 0.25rem;
  padding: 0.5rem;
  border: 5px dotted black;
}


fieldset {
  border: darkgrey 1px solid;
  padding: 0;
  margin-bottom: 2em; 
}

label {
  display: inline-block;
  padding: 0.5em;
  cursor: pointer;
}

.active {
  background: lightgrey;
}
var radios = document.querySelectorAll('.radio');
var container = document.getElementById('container');
radios.forEach(function(i){
    i.addEventListener('click', function(el){
        var clicked = el.currentTarget;
        var active = clicked.parentElement.parentElement.querySelector('.active');
        active && active.classList.remove('active');
        clicked.parentElement.classList.add('active');     
        container.className = 'container '+clicked.value;
    });
});

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.