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

              
                <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">

<div class="outer-div">
  <div class="inner-div1" style="background: #96D9E1">
    <h3>WORD LIST:</h3>
    <p><b>FRUIT: </b>Apple, Pear, Orange</p>
    <p><b>CARS: </b>FIAT, BMW, Ford</p>
    <p><b>COUNTRY: </b>Wales, England, Scotland, China</p>
    <p><b>COLOUR: </b>Red, Yellow, Pink, Green</p>
  </div>
  
  <div class="center-screen" style="background:#0F334D; color: white;">
    <p>Type a word from the list and see it get categorised:</p>
    <input type="text" style="width:90%; padding:10px;-webkit-border-radius: 50px; -moz-border-radius: 50px; border-radius: 50px;" id="FieldList"/>
    <p>NOTE: use a semi-colon (";") to seperate the words</p>
  </div>
  
  <div class="inner-div2">
    <div class="outer-div">
      <div class="inner-div inner-div-back1" style="  vertical-align: top;">
      <h4>Fruit List:</h4>
      <div id="ClassificationLevel1" class="ClassificationDIV">
        &nbsp;
      </div>
    </div>
    
    <div class="inner-div inner-div-back2" style="  vertical-align: top;">
      <h4>Car List:</h4>
      <div id="ClassificationLevel2" class="ClassificationDIV">
        &nbsp;
      </div>
    </div>
    
    <div class="inner-div inner-div-back3" style="  vertical-align: top;">
      <h4>Country List:</h4>
      <div id="ClassificationLevel3" class="ClassificationDIV">
        &nbsp;
      </div>
    </div>
    
    <div class="inner-div inner-div-back4" style="  vertical-align: top;">
      <h4>Colour List:</h4>
      <div id="ClassificationLevel4" class="ClassificationDIV">
        &nbsp;
      </div>
    </div>

    <div class="inner-div inner-div-back5" style="  vertical-align: top;">
      <h4>Unclassified:</h4>
      <div id="ClassificationLevelNone" class="ClassificationDIV">
        &nbsp;
      </div>
    </div>
  </div>
</div>
              
            
!

CSS

              
                body{
  font-family: 'Roboto', sans-serif;
  background-color:black;
}

.ClassificationLevel
{
  border: 1px solid black;
  border-radius: 7px;
  padding: 5px;
  margin: 4px;
  display: inline-block;
    background-color: orange;
  width:100px;
}

.center-screen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  border-radius: 1000px;
  -webkit-box-shadow: inset 2px 0px 5px 3px rgba(0,0,0,0.37);
  -moz-box-shadow: inset 2px 0px 5px 3px rgba(0,0,0,0.37);
  box-shadow: inset 2px 0px 5px 3px rgba(0,0,0,0.37);
}

.outer-div
{
  padding: 30px;
  text-align: center;
}

.inner-div-back1
{
  border: 5px solid black;
  background-color:#F39CC3;  
}
.inner-div-back2
{
  border: 5px solid black;
  background-color:red;  
}

.inner-div-back3
{
  background-color:#FAC174;
  border: 5px solid black;
}
.inner-div-back4
{
  border: 5px solid black;
  background-color:#0393D0;  
}
.inner-div-back5
{
  border: 5px solid black;
  background-color:#FDF2C5;  
}

.inner-div
{
  display: inline-block;
  padding: 30px;
}

.inner-div1
{
  background-color: white;
  display: inline-block;
  width: 90%;
  border-top-left-radius: 25px;
  border-top-right-radius: 25px;
}

.inner-div2
{
  background-color: white;
  display: inline-block;
  width: 90%;
  border-bottom-left-radius: 25px;
  border-bottom-right-radius: 25px;
}
              
            
!

JS

              
                $('#FieldList').keydown(function (e){

  //Create Temporary Arrays of Classification
  var Classification1 = ["apple", "pear", "orange"];
  var Classification2 = ["fiat","bmw", "ford"];
  var Classification3 = ["wales","england","scotland","china"];
  var Classification4 = ["red", "yellow", "pink", "green"];

  //Detect is a semi colon is pressed
if(e.keyCode == 59 || e.keyCode == 186){

      //Get the list of items that have been typed
      var str = $('#FieldList').val().toLowerCase();
      
      //Split them up into an array
      var FieldElements = str.split(";")

      $( ".ClassificationDIV" ).empty();
      
      for (i = 0; i < FieldElements.length; i++) {
       
        if(jQuery.inArray(FieldElements[i], Classification1) != -1)
        {
        $( "#ClassificationLevel1" ).append( "<span class='Level1 ClassificationLevel'>" + FieldElements[i] + "</span><br>" );
        }
        else if(jQuery.inArray(FieldElements[i], Classification2) != -1)
        {
        $( "#ClassificationLevel2" ).append( "<span class='Level2 ClassificationLevel'>" + FieldElements[i] + "</span><br>" );
        }
        else if(jQuery.inArray(FieldElements[i], Classification3) != -1)
        {
        $( "#ClassificationLevel3" ).append( "<span class='Level3 ClassificationLevel'>" + FieldElements[i] + "</span><br>" );
        }
        else if(jQuery.inArray(FieldElements[i], Classification4) != -1)
        {
        $( "#ClassificationLevel4" ).append( "<span class='Level4 ClassificationLevel'>" + FieldElements[i] + "</span><br>" );
        }
        else
        {
          $( "#ClassificationLevelNone" ).append( "<span class='LevelNone ClassificationLevel'>" + FieldElements[i] + "</span><br>" );
        }
      }
    }
})
              
            
!
999px

Console