Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

              
                <body class="bg-light-gray">
  <div>
    <section class="mt6  tc  pa5-ns ph5-ns">
      <h1 class=""><a href =         "https://en.wikipedia.org/wiki/Special:Random " target = "_blank" class="link f2-ns f4 lh-copy gray bg-animate hover-bg-light-blue tc-ns tl nowrap"> Click Here for a Random Article</a></h1>
      <p class="lh-copy measure-ns">
        <div class="tl pa4-l">
          <form class="bg-dark-blue-ns mw7-ns tc center pa4-ns br2-ns ba-ns b--black-10" id = "searchForm">
            <fieldset class="cf bn ma0 pa0">
              <legend class="pa0 f5 f4-ns mb3 light-gray-ns nowrap">Or Search Wikipedia for Keywords:</legend>
              <div class="cf">
                <input class="fl f6 f5-l input-reset bn black-80 bg-white fl pa3 lh-solid w-100 w-75-m w-80-l br2-ns br--left-ns" placeholder="Search here" type="text" name="Search" value="" id="Search">
                <button class="buttons fl f6 f5-l button-reset pv3 tc bn bg-animate bg-black-70 hover-bg-black white pointer w-100 w-25-m w-20-l br2-ns br--right-ns" id="SearchBtn" type="submit">Search</button>
              </div>
            </fieldset>
            <div id="wikiResults">
            </div>
          </form>
        </div>
      </p>
    </section>

  </div>
              
            
!

CSS

              
                
.buttons{
  -webkit-touch-callout: none; /* iOS Safari */
  -webkit-user-select: none;   /* Chrome/Safari/Opera */
  -khtml-user-select: none;    /* Konqueror */
  -moz-user-select: none;      /* Firefox */
  -ms-user-select: none;       /* Internet Explorer/Edge */
  user-select: none;           /* Non-prefixed version, currently
                                  not supported by any browser */
}
              
            
!

JS

              
                const url = 'https://en.wikipedia.org/w/api.php?';
const wikiPageURL = 'https://en.wikipedia.org/?curid=';
//$wgCrossSiteAJAXdomains = array( '*' );
$("#SearchBtn").click(function() {
  $.ajax({
    url: url,

    data: {
      action: 'query',
      prop: 'pageimages|extracts',
      generator: 'search',
      redirects: '1',
      piprop: 'original|name',
      pilimit: '10',
      exsentences: '1',
      exlimit: '10',
      exintro: '1',
      gsrnamespace: '',
      gsrlimit: '10',
      gsroffset: '0',
      gsrwhat: 'text',
      gsrprop: 'snippet|titlesnippet',
      gsrsearch: $('#Search').val(),
      format: 'json',
      origin: '*'
    },
    dataType: 'json'
  }).done(function(response) {
    let pages = response.query.pages; // server response
    var items = [];
    items.push("<main class='mw6 center'>");
    $.each(pages, function(key, val) {
      if (typeof(val.thumbnail) != 'undefined')
      {
        
    items.push("<article><a class='link dt w-100 bb b--black-10 pb2 mt2 dim blue' href="+wikiPageURL+val.pageid+" target='_blank'><div class='dtc w3'><img src="+val.thumbnail.original+" class='db w4 h-auto'/></div><div class='dtc v-top pl2'><h1 class='f6 f5-ns fw6 lh-title black mv0'>"+val.title+"</h1><h2 class='f6 fw4 mt2 mb0 black-60'>"+val.extract+"</h2></div></a></article>"
      );
    }
  });
    items.push("</main>");
    $("#wikiResults").html(items.join(""));
  });
});
$("#searchForm").submit(function() {
 $("#SearchBtn").click();
    return false;
});

              
            
!
999px

Console