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 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

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="container">
    <div class="card card_container">
      <h2 class="title">WikiViewer</h2>
      <h5 class="subtitle">What do you want to know today?</h5>
      <a class="btn btn-random" href="https://en.wikipedia.org/wiki/Special:Random" target="_blank"><i class="material-icons right">loop</i>Random Search</a><br>
      <div class="row col s12">
        <div class="input-field col offset-s3 s5">
          <input type="text" class="textarea" id="search">
          <label for="search">Search Wikipedia...</label>
        </div>
        <div class="col s1">
          <button class='src-btn' id='btn-src'><i class="material-icons">search</i></button>
          <br>
        </div>
      </div> <!-- end of col s12 -->
     
    </div> <!-- end of card_container -->
    <div class="hr_container">  
      <hr class="content_divider">
    </div>
  </div> <!-- end of container -->
  <div class="container-fluid" id="results_container"></div>
  <div class="footer container-fluid">
    <div class="col s12">
      <div class="row">
        <div class="col s5 credits align-left">
          <i class="fa fa-copyright"></i> 2016 <a href="http://spectrestudio.coolpage.biz" target="_blank">Spectre Studio</a> / Marco Mazzeo.
        </div>
        <div class="col s4 footer-logos">
          <a href="https://twitter.com/mmazzeo85" target="_blank"><i class="fa fa-twitter"></i></a>
          <a href="https://www.linkedin.com/in/marcomazzeo" target="_blank"><i class="fa fa-linkedin"></i></a>
          <a href="https://github.com/Doko85" target="_blank"><i class="fa fa-github"></i></a>
          <a href="https://freecodecamp.com/doko85" target="_blank"><i class="fa fa-fire"></i></a>
          <a href="https://codepen.io/doko/pens/public" target="_blank"><i class="fa fa-codepen"></i></a>
        </div>
        <div class="col s1 offset-s2 credits">
          <a href="#">Top <i class="fa fa-arrow-circle-o-up" aria-hidden="true"></i></a>
        </div>
      </div>
    </div> <!-- end of col s12 -->
  </div>
              
            
!

CSS

              
                @import 'https://fonts.googleapis.com/css?family=Alegreya|Quicksand|Titillium+Web|Yrsa';

body {
  background: #253035;
  text-align: center;
}

/* Main box CSS */

.card_container {
  background: rgba(52,104,130,0.4);
  color: #5B7582;
  max-width: 55em;
  max-height: 24em;
  position: relative;
  padding-top: 20px; 
  padding-bottom: 20px;
  margin: 50px auto;
  border-radius: 13px;
  box-shadow: 2px 2px rgba(0,0,0,0.18);
  text-align: center;
}

h2 {
  font-family: 'Quicksand', sans-serif;
  letter-spacing: 3px;
  margin: 0;
  padding: 0;
}

h5 {
  font-family: 'Quicksand', sans-serif;
  letter-spacing: 3px;
  margin-top: 0;
  padding-bottom: 20px;
}

.btn-random {
  background: #346882;
  margin-bottom: 15px;
}

.btn-random:hover,
.btn-random:focus {
  background: #FFF;
  color: #346882;
  font-weight: bold;
  -webkit-transition: .3s linear;
  -moz-transition: .3s linear;
  -ms-transition: .3s linear;
  -o-transition: .3s linear;
  transition: .3s linear;
}

.btn-random:hover i {
  -webkit-transition: 1s linear;
    -moz-transition:  1s linear;
    -ms-transition: 1s linear;
    -o-transition: 1s linear;
    transition:  1s linear;
  
  -webkit-transform: rotate(-360deg);
   -moz-transform: rotate(-360deg);
    -ms-transform: rotate(-360deg);
     -o-transform: rotate(-360deg);
        transform: rotate(-360deg);
}

label,
input {
  text-align: left;
  font-family: 'Quicksand', sans-serif;
  letter-spacing: 2.4px;
  font-weight: bold;
}

input {
  color: #91BACE!important;
}

label {
  color: #5B7582!important;
  font-size: 1.45em!important;
  line-height: 0.90;
}

#search,
#search:focus {
  font-size: 1.45em!important;
}

#search {
  border-bottom: 1px solid #5B7582;
  box-shadow: 0 1px 0 0 #5B7582;
}

#search:focus {
  border-bottom: 1px solid #91BACE;
  box-shadow: 0 1px 0 0 #91BACE;
}

.src-btn,
.src-btn:focus {
  color: #5B7582;
  display: block;
  width: 25px;
  height: 25px;
  line-height: 40px;
  margin: 0 auto;
  border: none;
  background: none;
  position: absolute;
  top: 214px;
}

.src-btn:focus,
.src-btn:hover {
  color: #91BACE;
}

/* divider CSS */

.content_divider { 
  margin: 25px 0;
  height: 1px;
  border: 0;
  width: 55em;
  background: #5B7582;
  background: -webkit-gradient(linear, 0 0, 100% 0, from(#253035), to(#253035), color-stop(50%, #5B7582));
}

.hr_container {
  width: 55em;
  position: relative;
  margin: auto;
  text-align: center;
}

/* Wikipedia results box */

.personal-card {
  display: block;
  background: rgba(52,104,130,0.3);
  color: #5B7582;
  box-shadow: 2px 2px rgba(0,0,0,0.18);
  text-align: left;
  margin-top: 25px;
  padding: 20px;
}

.personal-card:hover,
.personal-card:hover a {
  background: #FFF;
  color: #346882;
}

.result-title,
.description,
.link {
  font-family: 'Titillium Web', sans-serif;
  position: relative;
  font-weight: bold;
}

.result-title {
  font-size: 1.5em;
  letter-spacing: 2px;
}

.description {
  font-size: 1.2em;
}

.link {
  width: 100%;
  height: 100%;
  display: block;
  text-decoration: none;
  color: #5b7582;
  font-weight: bold;
  letter-spacing: 2px;
  font-size: 1.5em;
}

.link:hover {
  text-decoration: none;
} 

.external {
  text-align: right;
}

#description-box {
  padding-top: 15px;
}

.row {
  margin-bottom: 0!important;
}

.ui-menu .ui-menu-item {
  text-align: left!important;  
  background: #346882;
  font-size: 1.15em;
  color: #FFF;
  letter-spacing: 2px;
}

.ui-menu .ui-menu-item:hover,
.ui-menu .ui-menu-item:focus {
  border-top: 0;
  border-bottom: 0;
  }

/* Footer CSS */

.footer {
  position: relative;
  font-family: 'Titillium Web', sans-serif;
  font-weight: bold;
  font-size: 1.2em;
  letter-spacing: 2px;
  background: rgba(52,104,130,0.4);
  color: #5B7582;
  height: 4em;
  margin: 10px 15px 15px 15px;
}

.credits {
  margin-top: 20px;
}

.credits a {
  text-decoration: none;
  color: #5B7582;
}

.credits a:hover {
  text-decoration: underline;
  color: #346882;
}

.footer-logos {
  font-size: 14px;
  display: inline-block;
  position: relative;
}

.footer-logos a {
  text-decoration: none;
}

.footer-logos i {
  border: 2px solid #FFF;
  border: 2px solid rgba(255, 255, 255, .3);
  border-radius: 50%;
  color: #5B7582;
  opacity: .6;
  margin: 1.5em 0 1em 1em;
  padding-top: .45em;
  padding-left: .07em;
  text-align: center;
  vertical-align: -1.5em;
  position: relative;
}

.footer-logos i:hover {
  background: #346882;
  border: 2px solid rgba(255, 255, 255, .5);
  color: #FFF;
  opacity: 1;
}

.footer-logos .genericon {
  height: 1.6em;
  width: 1.6em;
}

.footer-logos .fa {
  height: 1.85em;  
  width: 1.85em;
}

.align-left {
  text-align: left;
}
              
            
!

JS

              
                $(document).ready(function() {
  $(".hr_container").hide();
  $(".footer").hide();
  $(document).keypress(function(event) {
    if(event.which == 13) {
      event.preventDefault();
      $('#results_container').empty();
        searchTheWiki();
    }; 
  }); // end of keypress function
  
  $('#btn-src').on('click', function() {
    $('#results_container').empty();
    searchTheWiki();
  });

  $("#search").autocomplete({
    source: function(request, response) {
    $.ajax({
      url: "https://en.wikipedia.org/w/api.php",
      dataType: "jsonp",
      data: {
         'action': "opensearch",
         'format': "json",
         'search': request.term
         },
         success: function(data) {
            response(data[1]);
         }
    });
  }
});

  function searchTheWiki() {
    // remove previous search results
    var query = $("#search").val();
    var url = 'https://en.wikipedia.org/w/api.php?action=query&format=json&prop=info&list=search&srsearch='+query+'&srlimit=10&callback=?';
    $.getJSON(url, function(data) {
      var title = [];
      var description = [];
      for (var i in data.query.search) { 
        title.push(data.query.search[i].title);
        description.push(data.query.search[i].snippet);
        // declare the <div> html 
        $('#results_container').append('<div class="card personal-card"><div class="row"><div class="col s9"><span class="result-title">' + title[i] + '</span></div><div class="col s3 external"><span><a class="link" href="https://en.wikipedia.org/wiki/' + title[i] + '" target="_blank">Read more&nbsp;<i class="fa fa-external-link" aria-hidden="true"></i></a></span></div><div class="col s12" id="description-box"><span class="description">' + description[i] + '...</span></div></div></div>');
        $('.hr_container').show();
        $('.footer').show();
      } // end of for loop
    }); // end of .getJSON
  }; // end of searchTheWiki function
});
              
            
!
999px

Console