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 Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

              
                <nav class="navbar navbar-default navbar-static-top pull-left">
      <div class="container-fluid">
        <div class="navbar-header">
          <a class="navbar-brand" href="#">Wikipedia Viewer</a>
        </div>
      </div>
</nav>

<section class="banner">
  <div class="container">
   <form>
     <label id="label-text" class="text-center">Input Text & Press Enter</label>
      <input id="search-box" type="text" name="search" placeholder="Search">
     <button id="submit-button" type="submit">Submit</button>
   </form>
  </div>
  
  <div id="result-container" class="container-fluid">   
    <ul id="result-list"></ul>
  </div>
</section>



              
            
!

CSS

              
                body{
  background: #85007A;
}

.navbar-default{
  background-color: rgba(0,0,0,0);
  padding: 20px;
  border:0px;
}

.navbar-brand{
  font-family: 'Pacifico', cursive;
  font-size: 40px;
  color: #CCA333 !important;
}

input[type=text] {
    width: 130px;
    box-sizing: border-box;
    border: 2px solid black;
    border-radius: 4px;
    font-size: 16px;
    background-color: white;
    padding: 12px 20px 12px 40px;
    margin: 10px 300px 10px 10px ;  
    -webkit-transition: width 0.4s ease-in-out;
    transition: width 0.4s ease-in-out;
}

input[type=text]:focus {
    width: 100%;
    border: 2px solid yellow;
}

.banner
{
  width: 100%;
  height: 300px;
  background-size: 100% 100%;
}

input[type=text]{
  display: block;
  margin-left: auto;
  margin-right: auto;
}

form{
  margin-top: 150px;
}

#submit-button{
  position: absolute; 
  left: -9999px;
}

label{
  margin-left: 460px;
  font-family: 'Lato' !important;
  font-weight: bold;
  font-size: 24px;
  color: black;
}

ul {
    margin-top: 14px;
    padding: 20px 0px 0px 0px;
    list-style-type:none;
}
ul li {
    font-family: Lato !important;
    background: #cce5ff;
    padding: 5px 5px 0px 5px;
    margin-left: 35px;
    margin-right: 35px;
}

ul li:hover{
   background: orange;
}
              
            
!

JS

              
                //http://pythontutor.com/javascript.html#mode=edit
var apiQuery = "";

$(document).ready(function(){
  $("#submit-button").on("click", function(event){
    //Cancelling out the default event of submit button
    event.preventDefault();
    //initialize arrays for title and snippets
    var titleArr = [];
    var snippetArr = [];
    //empty previous contents
    $("ul").empty();
    //WebService Call to wikipedia
    apiQuery = "https://en.wikipedia.org/w/api.php?action=query&list=search&srsearch="+$("#search-box").val()+"&format=json&callback=?";
    
    //Get JSON data for the search query
    $.getJSON(apiQuery,function(data){
        for(var i=0; i < data.query.search.length; i++){
        //Adding Titles to array
        titleArr.push("<a href=https://en.wikipedia.org/wiki/"+data.query.search[i].title.replaceAll(' ','_')+" target=\"_blank\"><li id=\"list-item\"><h3>"+data.query.search[i].title+"</h3>");
        //Adding Snippets to array
        snippetArr.push("<p>"+data.query.search[i].snippet+"</p></li></a>");
        //Appending the item to the list
        $('#result-list').append(titleArr[i] + snippetArr[i]);
      }
    });
      //delete both the arrays
      delete titleArr;
      delete snippetArr;
  });
});

//Refocus clears value in text box
$("#search-box").focus( function(){ 
  $(this).val(""); 
});

//Creating a replace all function for the link --> Credit to Chris West : http://cwestblog.com/2011/07/25/javascript-string-prototype-replaceall/
String.prototype.replaceAll = function(target, replacement) {
  return this.split(target).join(replacement);
};


              
            
!
999px

Console