css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


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.

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.

              <div class"container-fluid parent">
  <div class="row expSearchBox" id="child">
*::before {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;

body {
  background: #0F8A4D;

/* ******************************************************
	Expanding Search Bar - CSS Only Version

.expSearchBox {
  height: auto;
  float: right;
  margin: 28px 0;
  color: #FFFFFF;
  font-size: 18px;
  text-align: center;
  position: absolute;
  width: 100%;
  top: 50%;
  bottom: 50%;
.expSearchFrom {
  border: 3px solid #26D944;
  border-radius: 20px;
  display: inline-block;
  height: 34px;
  position: relative;
input.find {
	cursor: pointer;
  border: none;
  background: transparent;
  height: 30px;
  width: 0;
  line-height: 0;
  vertical-align: top;
  padding: 0 15px;
  -webkit-transition: width .5s; /* Safari */
  transition: width .5s; 
  position: relative;
  z-index: 2;
  color: #FFFFFF;
input.find.active, input.find:focus {
  width: 200px;
  outline: none;
  margin-right: 30px;
.close {
  position: absolute;
  width: 30px;
  height: 30px;
  top: 0;
  right: 0;
  -webkit-transition: .2s ease-in-out;
  -moz-transition: .2s ease-in-out;
  -o-transition: .2s ease-in-out;
  transition: .2s ease-in-out;
  cursor: pointer;   
  z-index: 1;
.close span {
  background: #26D944 none repeat scroll 0 0;
  border-radius: 3px;
  display: block;
  height: 4px;
  position: absolute;
  right: -7px;
  top: 29px;
  width: 14px;
	-webkit-transition: .2s .5s ease-in-out ;
  -moz-transition: .2s .5s ease-in-out;
  -o-transition: .2s .5s ease-in-out;
  transition: .2s .5s ease-in-out;    
  -webkit-transform: rotate(45deg);
  -moz-transform: rotate(45deg);
  -o-transform: rotate(45deg);
  transform: rotate(45deg);    
.close span.back{
  top: 12px;
  right: 5px;
  opacity: 0;
input.find:focus + .close span, input.find.active + .close span{
  top: 12px;
  right: 5px;
input.find:focus + .close span.back, input.find.active + .close span.back {
  -webkit-transition: .5s .7s ease-in-out ;
  -moz-transition: .5s .7s ease-in-out;
  -o-transition: .5s .7s ease-in-out;
  transition: .5s .7s ease-in-out;    
  -webkit-transform: rotate(45deg);
  -moz-transform: rotate(-45deg);
  -o-transform: rotate(-45deg);
  transform: rotate(-45deg);
  opacity: 1;
.articles {
  background-color: #ffffff;
.myList, a, p {
  color: #000000;
  background-color: #ffffff;
  text-align: left;
  margin-left: 60px;
  margin-right: 60px;
p {
  font-size: 18px;
.pageTitle {
  font-size: 25px;
  font-weight: bold;
.myList {
  cursor: pointer;
  position: relative;
  margin-right: 150px;
  margin-left: 150px;
.myList a {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  text-decoration: none; /* No underlines on the link */
  z-index: 10; /* Places the link above everything else in the div */
  background-color: #FFF; /* Fix to make div clickable in IE */
  opacity: 0; /* Fix to make div clickable in IE */
  filter: alpha(opacity=1); /* Fix to make div clickable in IE */
.myList:hover {
  -webkit-box-shadow: -6px 0 0 #26D944;
  -moz-box-shadow: -6px 0 0 #26D944;
  -o-box-shadow: -6px 0 0 #26D944;
  box-shadow: -6px 0 0 #26D944;
.parent {
  text-align: center;
              // Let's load everything first
var text = '<div class="col-md-12">Search here for random articles</div><br><br>';
text += '<div class="expSearchFrom"><input class="find" id="find" name="field" type="text" value=""><div class="close"><span class="front"></span><span class="back"></span></div></div><br><br>';
text += '<div class="col-md-12 list" id="list">Click an article below after a successful search</div>';

$(document).ready(function() {
  // keypress event
  $("input").keypress(function(e) {
    var dataToSearch = $("input[name=field]").val();
    // if event is equal to Enter key
    if (e.which === 13 || e.keycode === 13) {
      if ($('#list:empty').length) {
        $('#list').html("No article found!");
      } else if (dataToSearch === '') {
        $('#list').html("Please enter a keyword!");
      } else {
          top: 5
  // process and pull all the related information from Wikipedia based on inputted keyword
  function retrieveWiki(data) {
    var input = $('input');
    var toSearch = data;
    var searchUrl = 'https://en.wikipedia.org/w/api.php';

    var ajaxArticleData = function () {
        url: searchUrl,
        dataType: 'jsonp',
        data: {
          //main parameters
          action: 'query',
          format: 'json',
          generator: 'search',
          //parameters for generator
          gsrsearch: toSearch,
          gsrnamespace: 0,
          gsrlimit: 10,
          prop: 'extracts',
          //parameters for extracts
          exchars: 200,
          exlimit: 'max',
          explaintext: true,
          exintro: true,
        success: function (json) {          
          var pages = json.query.pages;
          $.map(pages, function (page) {
            var pageElement = $('<div class="myList">');
            //get the article title
            pageElement.append($('<p class="pageTitle">').text(page.title)).append($('</p>'));
            pageElement.append($('<a target="_blank">').attr('href', 'http://en.wikipedia.org/wiki/' + page.title).text(page.title)).append('</a>');
            //get the article text
        error: function() {
          $('#list').html('<p>An error has occurred</p>');

    toSearch = data;

$(document).ready(function() {
  // on out of focus
  $("#find").on("blur", function(){
    //$("#list").html("Click an article below after a successful search");
  // if the search box is clicked, make it active
  $("#find").on("click", function(){
  // the searh box will only close if the user pressed the x button
  // will clear the search box and move it back to the center of the page
  $('.close').on('click', function(){
    $("#list").html("Click an article below after a successful search");
      top: $(window).height()/2 - $(this).outerHeight()/2
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................