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.

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

            
              <!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>Wikipedia Viewer</title>
        <link rel="stylesheet" type="text/css" href="main.css">
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
    </head>
    <body>
        <div class="container">
          <div class="justify-content-center text-center row">
            <div class="col-md-10">
              <h1>Wikipedia Viewer App</h1>
              <br>
              <form>
                <div class="row justify-content-center form-group">
                  <div class="col-md-8">
                    <input id="searchBar" class="form-control" type="search" name="search" placeholder="search">
                  </div>
                  <div class="col-md-4">
                    <button id="searchButton" class="btn btn-primary" type="submit" name="submit">Search</button>
                    <button id="random" type="submit" name="button" class="btn btn-primary">Random Article</button>
                  </div>
                </div>
              </form>

              <div id="group" class="list-group">

                <a   id="list0" class="list-group-item list-group-item-action flex-column align-items-start">
                  <div class="d-flex w-100 justify-content-between">
                    <h5 id="header0" class="mb-1"></h5>
                  </div>
                  <p id="description0" class="mb-1"> </p>

                </a>

                <a   id="list1" class="list-group-item list-group-item-action flex-column align-items-start">
                  <div class="d-flex w-100 justify-content-between">
                    <h5 id="header1" class="mb-1"></h5>
                  </div>
                  <p id="description1" class="mb-1"> </p>

                </a>

                <a   id="list2" class="list-group-item list-group-item-action flex-column align-items-start">
                  <div class="d-flex w-100 justify-content-between">
                    <h5 id="header2" class="mb-1"></h5>
                  </div>
                  <p id="description2" class="mb-1"> </p>

                </a>

                <a   id="list3" class="list-group-item list-group-item-action flex-column align-items-start">
                  <div class="d-flex w-100 justify-content-between">
                    <h5 id="header3" class="mb-1"></h5>
                  </div>
                  <p id="description3" class="mb-1"> </p>

                </a>

                <a   id="list4" class="list-group-item list-group-item-action flex-column align-items-start">
                  <div class="d-flex w-100 justify-content-between">
                    <h5 id="header4" class="mb-1"></h5>
                  </div>
                  <p id="description4" class="mb-1"> </p>

                </a>

                <a   id="list5" class="list-group-item list-group-item-action flex-column align-items-start">
                  <div class="d-flex w-100 justify-content-between">
                    <h5 id="header5" class="mb-1"></h5>
                  </div>
                  <p id="description5" class="mb-1"> </p>

                </a>

                <a   id="list6" class="list-group-item list-group-item-action flex-column align-items-start">
                  <div class="d-flex w-100 justify-content-between">
                    <h5 id="header6" class="mb-1"></h5>
                  </div>
                  <p id="description6" class="mb-1"> </p>

                </a>

                <a   id="list7" class="list-group-item list-group-item-action flex-column align-items-start">
                  <div class="d-flex w-100 justify-content-between">
                    <h5 id="header7" class="mb-1"></h5>
                  </div>
                  <p id="description7" class="mb-1"> </p>

                </a>

                <a   id="list8" class="list-group-item list-group-item-action flex-column align-items-start">
                  <div class="d-flex w-100 justify-content-between">
                    <h5 id="header8" class="mb-1"></h5>
                  </div>
                  <p id="description8" class="mb-1"> </p>
                  <small class="text-muted"></small>
                </a>

                <a   id="list9" class="list-group-item list-group-item-action flex-column align-items-start">
                  <div class="d-flex w-100 justify-content-between">
                    <h5 id="header9" class="mb-1"></h5>
                  </div>
                  <p id="description9" class="mb-1"> </p>
                  <small class="text-muted"></small>
                </a>

              </div>

            </div>
          </div>
        </div>
        <br><br>
        <script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script>
        <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
        <script type="text/javascript" src="main.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
    </body>
</html>

            
          
!

CSS

            
              body{
  background-image: linear-gradient( 135deg, #FAB2FF 10%, #1904E5 100%);
  min-height: 100vh;
}

.text{
  color: #c3073f;
}

.white{
  color: white;
}
            
          
!

JS

            
              $(document).ready(function() {
    $('#group').hide();
    //random article wikipedia generator
    var randomArticleLink = "https://en.wikipedia.org/wiki/Special:Random";

    //Opens a wikipedia article at random
    $("#random").click(function() {
      //prevents page from reloading
      event.preventDefault();
      window.open(randomArticleLink);
    });

    //loops through the title array
    function titleLoop(array){
        for(var i = 0; i<array[1].length; i++){
            $('#header' + i).html(array[1][i]);
        }
    }

    //loops through the description array
    function descriptionLoop(array){
        for(var i=0; i<array[2].length; i++){
            $('#description' + i).html(array[2][i]);
        }
    }

    //loops through the links array
    function listLoop(array){
        for(var i=0; i<array[3].length; i++){
            $('#list'+i).attr({'href': array[3][i], 'target': '_blank'});
        }
    }


    //retrieves search results on click
    $('#searchButton').click(function(event) {
        //prevents page from reloading
        event.preventDefault();
        //shows results
        $('#group').slideDown();
        //selects data in search bar
        var userInput = $('#searchBar').val();
        //imports user input into api call
        var wikiApi = 'https://en.wikipedia.org/w/api.php?action=opensearch&format=json&requestid=&search='
        + encodeURIComponent(userInput) + '&namespace=&profile=fuzzy&origin=*';
        //gets json data from Wikipedia
        $.getJSON(wikiApi, function(json) {
            titleLoop(json);
            descriptionLoop(json);
            listLoop(json);
        });
    });

});

            
          
!
999px

Console