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.


                <div class="container">
  <h1> Wikipedia Viewer </h1>
  <div id="container">
  <button id="random" type="button">Random Article</button>
  <input id="search" type="text" name="search" placeholder="Search - Type & Press Enter">
  <div id="content">



                @import url('');

  background-color: #ed6753;

  font-family: 'Yrsa',serif;
  color: white;
  text-align: center;
  display: block;
  margin: 20vh auto 0;
  border-radius: 6px;
  font-family: 'Yrsa',serif;
  font-size: 25px;
  color: white;
 /* transition: transform 0.1s;*/

  margin: 2vh auto 0;
  background-image: url(''); 
  background-position: 96% 5px; 
  background-repeat: no-repeat;
  padding: 0px 40px 0px 10px;
  background-size: 25px 25px;
  width: 300px;
  border-radius: 6px;
  transition: width 1s;
  transition: transform 1s;

  width: 500px;
  transition: width 1s;
/*  transition: transform 1s;*/

  transform: translate(0,-20vh);
  transition: transform 1s;

  margin: 0 auto;
  padding: 20px;
  color: #4c4c4c;
  border-radius: 5px;



                $("#random").click(function() {"");;
}) // Random Article Page Button

//Detects if the Enter Key is Pressed, Most likely pressed when typed something in search box

$(document).keypress(function(e) {
  if (e.which == 13 && document.getElementById("search").value.length != 0) { // checks if the key pressed is enter
    $("#container").addClass("moveup"); //moveup class adds a smooth transition effect
   // $("#random").addClass("moveup");
    content = document.getElementById("search").value; //Sets the content variable to what is inside search box

    var url = "" + content + "&format=json" // URL for JSON API

    $.getJSON(url).done(function(data) { // Gets JSON data from wikipedia API

      var contenthtml = ""; // For Adding the boxes
      for (var i = 0; i < data[1].length; i++) { // For loop for adding boxes, more convinient than typing divs for all the result boxes
        var title = data[1][i];
        var abstract = data[2][i];

        contenthtml += "<br><div class=gray><h5><b><a href='" + title + "' target = _blank>" + title + "</a></b></h5><br><p> " + abstract + "</p></div><br>";


      $('#content').html(contenthtml); // Sets the content Html to id content 

      if (data[1].length === 0) { // Length is 0, when user types in something invalid, as the API returns nothing
        $('#content').html("<div class='gray'><h5 style='text-align:center;'> You typed in something Invalid. <h5></div>"); // Box for telling user that it's an error


    }).fail(function() {
      console.log("<div class='gray'><h5 style='text-align:center;'> Error retrieving data from server, Try Again Later <h5></div>"); //Incase there's an error with the server