Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <h1>
CSS Multi-Column: column-span demo
</h1>

<form>
  <fieldset>
    <label class="active">
      <input type="radio" name="class" value="container--one" checked="checked" class="radio">
      <code>column-span: none</code>
    </label>
    <label>
      <input type="radio" name="class" value="container--two" class="radio">
      <code>column-span: all</code>
    </label>
  </fieldset>  
</form>

<div class="container container--one" id="container">
  <h2>
    The heading
  </h2>
  <p>
    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Error laudantium dicta maiores voluptatibus corporis aliquid placeat porro fugit? Voluptatibus impedit dolor nesciunt, corrupti reiciendis molestias minima amet itaque rem! Ipsam?
  </p>
  <p>
    Donec ligula ligula, egestas non dignissim at, consequat ac purus. Mauris tempus tempor magna in congue. In congue sed massa sed fringilla. Nunc interdum metus sed eleifend finibus. Pellentesque mi magna, pharetra quis accumsan et, varius nec dolor.
  </p>
  <h2>
    The another heading
  </h2>  
  <p>
    Sed tempus faucibus ante quis consequat. Nunc in dolor pretium, gravida lectus eu, ornare orci. Vestibulum lobortis pellentesque nibh in sagittis. Praesent eget rhoncus diam, id finibus ante. Nunc vulputate dolor quis felis ullamcorper, a maximus elit tempor.
  </p>
  <p>
    Curabitur nec lacinia ipsum. Duis tortor nisl, imperdiet id nunc eget, gravida pretium erat. Quisque id neque fringilla, molestie ante nec, vulputate augue. 
  </p>
  <p>
    Vestibulum sed finibus ligula, et cursus sem. Vestibulum quis laoreet tellus. Vivamus interdum varius ultrices. Nullam accumsan eget dolor eget commodo. Praesent nec venenatis turpis, quis ultrices tortor. 
  </p>
  
</div>
              
            
!

CSS

              
                .container--one h2 {
  column-span: none;
}

.container--two h2 {
  column-span: all;
}


/* ETC (Formatting only): */

body {
  margin: 1.5em;
  font-size: 130%;
  font-family: sans-serif;
  background: #F2F0EC;
  color: #2E2C08;
}

.container { 
  border: 10px solid #2E2C08;
  background: white;  
  padding: 1rem;
}

.box {
  margin: 0.25rem;
  padding: 0.5em;
  text-align: center;
  background: #e5e3de;
}

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

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

.active {
  background: #abab9d;
}

.container {
  padding: 1rem;
  columns: 15em 3;
}

h2 {
  margin-top: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dotted grey;
}


              
            
!

JS

              
                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;
    });
});
              
            
!
999px

Console