Pen Settings



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


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


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.


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.


  <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="">
  <link rel="stylesheet" href="">

  .button-success {
            background: rgb(28, 184, 65); /* this is a green */
  color: white;
            border-radius: 4px;
            text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);

<h1 class="text-center">Wikipedia Viewer</h1>
  <div class="text-center">

    <form class=" pure-form">
    <input class="pure-input-1-3" type="text" placeholder="Search here" id = "search-input">
    <button id="search-bar"class="btn btn-primary fa fa-search"></button>
  <a href="" target="_blank"><button class="button-success pure-button">Random Article</button></a>
    <div id="results"></div>



                @media all and (min-width: 320px) {
body {
   background: white;
   color: #333333;
 input {
   display: inline-block !important;}

#results {
  width: 700px;
  margin: 40px auto;
  text-align: left;

.result {
  background: #F7F7F7;
  padding: 20px;
  border: 1px solid #CCC;
  margin-bottom: 10px;

.result a {
  font-size: 20px;
  font-weight: bold;

.result .extract {
  margin-top: 6px;


                var keyword = '';

    var input = document.getElementById("search-input");
    keyword = input.value;
    input.disabled = true;
    input.value = `searching for '${keyword}'... please wait`;


window.onload = function()  {

function enableSearchInput() {
    var input = document.getElementById("search-input");
    input.disabled = false;
    input.value = keyword;

  function renderHTML(data) {
    $('#results').append(`<div class="result"><a href="${data.pageid}" target="_blank">${data.title}</a><div class="extract">${data.extract}</div></div>`);

function showError() {
    $('#results').html(`<div class="error"><h1>Error Occoured.</h1><p>No results found for keyword <strong>${keyword}</strong></p></div>`);

function showResults(data) {
  var results = data.query.pages;
  var articles = [];

  for (var result_id in results) {
    articles.push( results[result_id] );
  $('#results').html(''); // remove previous results..if any.
  articles.forEach( renderHTML );

function ajax (keyword) {
    // url: "" + keyword + "&prop=extracts&gsrnamespace=0&inprop=url&utf8=&format=json",
     url: '|extracts&pilimit=max&exintro&explaintext&exsentences=1&exlimit=max&gsrsearch='+ keyword +'&utf8&format=json',

   dataType: "jsonp",
   success: function(response) {
       if ( !response || !response.query || !response.query.pages || response.query.pages.length === 0 ) {
       else {
   error: function () {
    alert("Error retrieving search results, please refresh the page");