Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

Save Automatically?

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 class="wrapper">
<input type="text" autocomplete="off" id="myInput" onkeyup="myFunction()" placeholder="">

<ul id="myUL">
  <li><a href="#" class="header">Preferred Labs</a></li>
  <li><a href="#">Aurora Diagnostics Bernhardt Laboratories</a></li>
  <li><a href="#">BioArt Laboratories</a></li>
  <li><a href="#">CBLPath</a></li>
  <li><a href="#">C & C</a></li>  
  <li><a href="#">CSI Laboratories</a></li>
  <li><a href="#">Genoma Laboratory</a></li>
  <li><a href="#">LabCorp</a></li>
  <li><a href="#">MicroPath Laboratories</a></li>
  <li><a href="#">NeoGenomics Laboratories</a></li>
  <li><a href="#">Vitro Molecular Laboratories</a></li>
  
  <li><a href="#" class="header">National Labs</a></li>
  <li><a href="#">ABC Lab</a></li>
  <li><a href="#">ARUP Laboratories</a></li>
  <li><a href="#">EGL Genetics</a></li>
  <li><a href="#">Greenwood Genetic</a></li>
  <li><a href="#">Myriad Genetics</a></li>
  <li><a href="#">Sequenom Laboratories</a></li>
  <li><a href="#">Quest Diagnostics</a></li>

  <li><a href="#" class="header">Other</a></li>
  <li><a href="#">ABC Molecular</a></li>
  <li><a href="#">DEF Lab</a></li>
  <li><a href="#">GHI Lab</a></li>
  <li><a href="#">JKL Laboratories</a></li>
  <li><a href="#">MNO Lab</a></li>
  <li><a href="#">PQE Lab</a></li>
  <li><a href="#">STU Genetics</a></li>
  <li><a href="#">VWX Lab</a></li>
  <li><a href="#">YZ Molecular</a></li>	
</ul>
</div>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Source+Sans+Pro:400');

html, body {
  font-family: 'Source Sans Pro', sans-serif;
	font-size: 14px;
  background: #f5f5f5;
	color: #444;
  width: 400px;
  -webkit-font-smoothing: antialiased;
}

.wrapper {
  background-color: #fff;
  padding: 5px;
  border: 1px solid #ddd;  
}

input[type=text]::-ms-clear {
    display: none;
}

#myInput {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    margin: 0px 0px 5px 0px;
    padding: 0px 20px 1px 5px;
    width: 100%;
    height: 25px;
    outline: 0;
    border: 1px solid #ddd;
    background: white url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/35790/chosen-sprite.png) no-repeat 100% -20px;
    font-size: 14px;
    font-family: 'Source Sans Pro', sans-serif;
    line-height: normal;
    border-radius: 0;
}

#myUL {
    /* Remove default list styling */
    list-style-type: none;
    padding: 0;
    margin: 0;
    height: 100%;
    max-height: 240px;
    overflow-y: auto;
}

#myUL li a {
    background-color: #fff; /* Grey background color */
    padding: 6px 24px; /* Add some padding */
    text-decoration: none; /* Remove default text underline */
    font-size: 14px; /* Increase the font-size */
    color: black; /* Add a black text color */
    display: block; /* Make it into a block element to fill the whole list */
}

#myUL li a.header {
    padding: 6px 12px;  
    font-weight: bold;
    cursor: default; /* Change cursor style */
}

#myUL li a:hover:not(.header) {
    background-color: #3BAFDA; /* Add a hover effect to all links, except for headers */
    color: #fff;
}

#myUL.notFound::after {
  padding: 0px 6px;  
  content: "No results found.";
}
              
            
!

JS

              
                function myFunction() {
    // Declare variables
    var input, filter, ul, li, a, i, curGroup, matchGroup;
    input = document.getElementById('myInput');
    filter = input.value;
    ul = document.getElementById("myUL");
    li = ul.getElementsByTagName('li');

    var re = new RegExp("("+filter.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')+")", "ig");
  
    // Loop through all list items, and hide those who don't match the search query
    for (i = 0; i < li.length; i++) {
        a = li[i].getElementsByTagName("a")[0];
          if (a.className == 'header') {
            curGroup = li[i];
            matchGroup = false;
          }
      // Reset underlines
      a.innerHTML = a.innerHTML.replace(/<[^>]+>/g,"");
        // Check for match
        if (a.innerText.search(re) > -1 || matchGroup) {
          // Check if match is a header
          if (a.className == 'header') {
            matchGroup = true;
          }
          if (filter.length > 0) {
            a.innerHTML = a.innerHTML.replace(/&amp;/gi,"&").replace(re, '<u>$1</u>');
          }
          li[i].style.display = "";
          curGroup.style.display = "";
        } else if (!matchGroup) {
          // No match on current item or group
          li[i].style.display = "none";
        }
    }
  // Check result height after loop
  ul.className = (ul.offsetHeight < 22) ? "notFound" : "";
}
              
            
!
999px

Console