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

              
                <div id="wrapper">
  <p class="intro">Below is a list of core values commonly used by leadership institutes and programs. This list is not exhaustive, but it will give you an idea of some common core values (also called personal values). Recommendation is to select less than five core values to focus on - if everything is a core value, then nothing is really a priority.</p>
  
  <ul id="choices">
    <li><input type="checkbox" id="authenticity" value="Authenticity" /><label for="authenticity">Authenticity</label></li>
    <li><input type="checkbox" id="achievement" value="Achievement" /><label for="achievement">Achievement</label></li>
    <li><input type="checkbox" id="adventure" value="Adventure" /><label for="adventure">Adventure</label></li>
    <li><input type="checkbox" id="authority" value="Authority" /><label for="authority">Authority</label></li>
    <li><input type="checkbox" id="autonomy" value="Autonomy" /><label for="autonomy">Autonomy</label></li>
    <li><input type="checkbox" id="balance" value="Balance" /><label for="balance">Balance</label></li>
    <li><input type="checkbox" id="beauty" value="Beauty" /><label for="beauty">Beauty</label></li>
    <li><input type="checkbox" id="boldness" value="Boldness" /><label for="boldness">Boldness</label></li>
    <li><input type="checkbox" id="compassion" value="Compassion" /><label for="compassion">Compassion</label></li>
    <li><input type="checkbox" id="challenge" value="Challenge" /><label for="challenge">Challenge</label></li>
    <li><input type="checkbox" id="citizenship" value="Citizenship" /><label for="citizenship">Citizenship</label></li>
    <li><input type="checkbox" id="community" value="Community" /><label for="community">Community</label></li>
    <li><input type="checkbox" id="competency" value="Competency" /><label for="competency">Competency</label></li>
    <li><input type="checkbox" id="contribution" value="Contribution" /><label for="contribution">Contribution</label></li>
    <li><input type="checkbox" id="creativity" value="Creativity" /><label for="creativity">Creativity</label></li>
    <li><input type="checkbox" id="curiosity" value="Curiosity" /><label for="curiosity">Curiosity</label></li>
    <li><input type="checkbox" id="determination" value="Determination" /><label for="determination">Determination</label></li>
    <li><input type="checkbox" id="fairness" value="Fairness" /><label for="fairness"">Fairness</label></li>
    <li><input type="checkbox" id="faith" value="Faith" /><label for="faith">Faith</label></li>
    <li><input type="checkbox" id="fame" value="Fame" /><label for="fame">Fame</label></li>
    <li><input type="checkbox" id="friendships" value="Friendships" /><label for="friendships">Friendships</label></li>
    <li><input type="checkbox" id="fun" value="Fun" /><label for="fun">Fun</label></li>
    <li><input type="checkbox" id="growth" value="Growth" /><label for="growth">Growth</label></li>
    <li><input type="checkbox" id="happiness" value="Happiness" /><label for="happiness">Happiness</label></li>
    <li><input type="checkbox" id="honesty" value="Honesty" /><label for="honesty">Honesty</label></li>
    <li><input type="checkbox" id="humor" value="Humor" /><label for="humor">Humor</label></li>
    <li><input type="checkbox" id="influence" value="Influence" /><label for="influence">Influence</label></li>
    <li><input type="checkbox" id="inner-harmony" value="Inner Harmony" /><label for="inner-harmony">Inner Harmony</label></li>
    <li><input type="checkbox" id="justice" value="Justice" /><label for="justice">Justice</label></li>
    <li><input type="checkbox" id="kindness" value="Kindness" /><label for="kindness">Kindness</label></li>
    <li><input type="checkbox" id="knowledge" value="Knowledge" /><label for="knowledge">Knowledge</label></li>
    <li><input type="checkbox" id="leadership" value="Leadership" /><label for="leadership">Leadership</label></li>
    <li><input type="checkbox" id="learning" value="Learning" /><label for="learning">Learning</label></li>
    <li><input type="checkbox" id="love" value="Love" /><label for="love">Love</label></li>
    <li><input type="checkbox" id="loyalty" value="Loyalty" /><label for="loyalty">Loyalty</label></li>
    <li><input type="checkbox" id="meaningful-work" value="Meaningful Work" /><label for="meaningful-work">Meaningful Work</label></li>
    <li><input type="checkbox" id="openness" value="Openness" /><label for="openness">Openness</label></li>
    <li><input type="checkbox" id="optimism" value="Optimism" /><label for="optimism">Optimism</label></li>
    <li><input type="checkbox" id="peace" value="Peace" /><label for="peace">Peace</label></li>
    <li><input type="checkbox" id="pleasure" value="Pleasure" /><label for="pleasure">Pleasure</label></li>
    <li><input type="checkbox" id="poise" value="Poise" /><label for="poise">Poise</label></li>
    <li><input type="checkbox" id="popularity" value="Popularity" /><label for="popularity">Popularity</label></li>
    <li><input type="checkbox" id="recognition" value="Recognition" /><label for="recognition">Recognition</label></li>
    <li><input type="checkbox" id="religion" value="Religion" /><label for="religion">Religion</label></li>
    <li><input type="checkbox" id="reputation" value="Reputation" /><label for="reputation">Reputation</label></li>
    <li><input type="checkbox" id="respect" value="Respect" /><label for="respect">Respect</label></li>
    <li><input type="checkbox" id="responsibility" value="Responsibility" /><label for="responsibility">Responsibility</label></li>
    <li><input type="checkbox" id="security" value="Security" /><label for="security">Security</label></li>
    <li><input type="checkbox" id="self-respect" value="Self-Respect" /><label for="self-respect">Self-Respect</label></li>
    <li><input type="checkbox" id="service" value="Service" /><label for="service">Service</label></li>
    <li><input type="checkbox" id="spirituality" value="Spirituality" /><label for="spirituality">Spirituality</label></li>
    <li><input type="checkbox" id="stability" value="Stability" /><label for="stability">Stability</label></li>
    <li><input type="checkbox" id="success" value="Success" /><label for="success">Success</label></li>
    <li><input type="checkbox" id="status" value="Status" /><label for="status">Status</label></li>
    <li><input type="checkbox" id="trustworthiness" value="Trustworthiness" /><label for="trustworthiness">Trustworthiness</label></li>
    <li><input type="checkbox" id="wealth" value="Wealth" /><label for="wealth">Wealth</label></li>
    <li><input type="checkbox" id="wisdom" value="Wisdom" /><label for="wisdom">Wisdom</label></li>
    </ul>
    
  <div class="footer"><p>Core Values list by <a href="https://jamesclear.com/core-values">James Clear</a>. Code by <a href="https://wahalahti.fi">Timi "sippis" Wahalahti</a>.</p></div>
  
  <div id="info"><p><span id="choices-count">0</span> core values selected, <button id="show-result">see only those</button>.</p></div>
  <div id="reset"><p><input type="button" value="Reset" onClick="history.go(0);"></p></div>
</div>
              
            
!

CSS

              
                #wrapper {
  max-width: 640px;
  margin: 75px auto 50px auto;
  padding: 0 25px;
  font-family: sans-serif;
  font-size: 1.2rem;
  line-height: 1.8rem;
  color: #333;
  
  ul {
    list-style: none;
    margin: 50px 0;
    padding: 0;
    
    li {
      display: inline;
      
      input {
        display: absolute;
        position: absolute;
        opacity: 0;
      }
        
      input:checked + label {
        border: 2px solid #555;
        color: #555;
        transition: all .2s;
      }
      
      label {
        display: inline-block;
        background-color: rgba(255, 255, 255, .9);
        border: 2px solid rgba(139, 139, 139, .3);
        color: #adadad;
        border-radius: 25px;
        white-space: nowrap;
        margin: 5px 2px;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
        transition: all .2s;
        padding: 6px 14px 3px 12px;
        cursor: pointer;
        
        &:hover,
        &:focus {
          border: 2px solid #555;
          color: #555;
          background-color: rgba(139, 139, 139, .1);
        }
      }
    }
  }
  
  .footer {
    text-align: center;
    font-size: 1rem;
    color: #888;
    
    a {
      color: #888;
    }
  }
  
  #info,
  #reset {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #eee;
    padding: 10px;
    color: #555;
    font-size: 1rem;
    
    p {
      margin: auto;
      padding: 0 25px;
      max-width: 640px;
      display: block;
    }
    
    button,
    input{
      border: none;
      border-bottom: 2px solid #555;
      padding: 0;
      font-size: 1rem;
      color: #555;
      
      &:hover,
      &:focus {
        border-color: #333;
        color: #333;
        cursor: pointer;
      }
    }
  }
  
  #info {
    &.visible {
      display: block;
    }
  }
  
  &.results {
    li {
      &.hidden {
        display: none;
      }
    }
    
    #info {
      display: none;
    }
    
    #reset {
      display: block;
    }
  }
}
              
            
!

JS

              
                checkboxes = document.querySelectorAll('input[type=checkbox]:checked');
for (var i = 0; i < checkboxes.length; i++) {
  checkboxes[i].checked = false;
}

document.addEventListener('click', function (event) {
  if (event.target.type === 'checkbox') {    
    var count = updateSelectedCount();
    if ( count > 0 ) {
      document.getElementById('info').className = 'visible';
    } else {
      document.getElementById('info').className = '';
    }
  } else if (event.target.id === 'show-result') {   
    showOnlySelected();
    document.getElementById('wrapper').className = 'results';
  }
}, false);

function updateSelectedCount() {
  var checkboxes = document.querySelectorAll('input[type=checkbox]:checked');
  document.getElementById('choices-count').innerHTML = checkboxes.length;
  return checkboxes.length;
}

function showOnlySelected() {
  var checkboxes = document.querySelectorAll('input[type=checkbox]:not(:checked)')

  for (var i = 0; i < checkboxes.length; i++) {
    checkboxes[i].parentNode.className = 'hidden';
  }
}
              
            
!
999px

Console