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.

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

              
                <section class="Content">
  <div class="Search">
      <h1 class="mb3 align-center">Wikipedia Viewer</h1>
      <h2 class="align-center">What would you like to read?</h2>
      <form action="">
        <div class="Input-group is-flex">
          <div class="Input-holder">
            <input type="search" class="Input-Search" id="search-input">
              <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="28" height="28" viewBox="0 0 28 28" class="Icon Icon-lens">
                <path d="M31.01 27.23l-7.58-6.45c-0.78-0.7-1.62-1.03-2.3-1 1.79-2.1 2.87-4.82 2.87-7.79 0-6.63-5.37-12-12-12s-12 5.37-12 12 5.37 12 12 12c2.97 0 5.69-1.08 7.79-2.87-0.03 0.68 0.29 1.52 1 2.3l6.45 7.58c1.1 1.23 2.91 1.33 4.01 0.23s1-2.9-0.23-4.01zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"/>
              </svg>
          </div>
          <div class="Button-holder">
            <button class="Btn Btn-action Button--search" id="button-search">Search</button>
          </div>
        </div>
      </form>
      <div class="align-center">
        <a target="_blank" href="http://en.wikipedia.org/wiki/Special:Random" class="Btn Btn-action Btn--random" id="btn-random">Random article</a>
      </div>

    </div>

    <div class="Topic">
      <ul class="Topic-items" id="Topic-list">         </ul>
    </div>
  </section>
<footer class="Footer">
  <p class="mb0">Coded and design by <a target="_blank" href="http://gemaderus.com/">Gema de Rus</a></p>
  <span>Photo by </span><a target="_blank" href="http://www.freepik.com">Designed by balasoiu / Freepik</a>
</footer>
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css?family=Montserrat");

*,
*:before,
*:after {
  box-sizing: inherit;
}

ul {
  padding: 0;
  margin: 0;
}

html {
  box-sizing: border-box;
  font-family: 'Montserrat', sans-serif;
  font-size: 62.5%;
  line-height: 1.5;
  position: relative;
  height: 100%;
}

body {
  overflow-x: hidden;
  min-height: 100%;
  background-image: url(https://www.dropbox.com/s/w1jjj5agy6151bm/powerfull.jpg?raw=1);
  background-repeat: no-repeat;
  background-size: cover;
  color: darken(#C3E1E9, 20);
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  line-height: 1;
}

a {
  cursor: pointer;
  text-decoration: none;
}

p {
  margin: 0;
}

.Btn {
  -webkit-appearance: none;
  -moz-appearance:    none;
  appearance:         none;
  background-color: transparent;
  border-radius: 6px;
  border: 0;
  display: inline-block;
  font-family: inherit;
  font-size: 16px;
  line-height: 1;
  margin: 0;
  outline: none;
  padding: 25px 15px;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  transition: 0.25s;
}

.Btn-action {
  background-color: #FF5FAB;
  color: white;

    &:hover {
    background-color: darken(#FF5FAB, 10);
  }
}

.Button-holder {
  flex-basis: 20%;
}

.Button--search {
  border-radius: 0 6px 6px 0;
  width: 100%;
  height: 100%;
}

.Content {
  align-self: center;
  flex: 1;
  max-width: 100%;
  padding: 20px;
}

.Footer {
  font-size: 16px;
  padding: 20px;
  text-align: center;

  a {
    color: #FF5FAB;

    &:hover {
      text-decoration: underline;
    }
  }
}

.Icon {
  display: inline-block;
}

.Icon-lens {
  fill: #929487;
  left: 20px;
  pointer-events: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.Input-group {
  position: relative;

  .Input-holder {
    flex: 1;
  }
}

input[type="search"] {
  box-sizing: border-box;
}

.Input-Search {
  border-radius: 6px 0  0 6px;
  border: 0;
  color: #929487;
  font-size: 20px;
  outline: none;
  padding: 20px 20px 20px 65px;
  width: 100%;
}

body.is-clicked {
  background-image: none;
  background-color: darken(#C3E1E9, 20);
  color: white;
  transition: background-color 0.3s;
}

.is-flex {
  display: flex;
}

.Search {
  max-width: 100%;
  padding: 5rem 0px;

  h1 {
    font-size: 30px;
  }

  h2 {
    font-size: 20px;
  }

  @media screen and (min-width: 600px) {

    h1 {
      font-size: 40px;
    }

    h2 {
      font-size: 30px;
    }
  }

  @media screen and (min-width: 810px) {
    width: 800px;
  }
}

form, h2 {
  margin-bottom: 5rem;
}

.Topic-items {
  color: #929487;
  max-width: 100%;

  @media screen and (min-width: 810px) {
    width: 800px;
  }
}

.Topic-item {
  background-color: white;
  border-radius: 10px;
  margin-bottom: 5rem;
  max-width: 100%;
  padding: 30px;

  h3 {
    border-bottom: 1px solid #ddd;
    font-size: 20px;
    margin-bottom: 30px;
    padding-bottom: 30px;
  }

  p {
    font-size: 16px;
    margin-bottom: 30px;
  }
}

.align-center {
  text-align: center;
}

.align-right {
  text-align: right;
}

.align-right {
  text-align: left;
}

.mb0 {
  margin-bottom: 5px;
}

.mb1 {
  margin-bottom: 1rem;
}

.mb2 {
  margin-bottom: 2rem;
}

.mb3 {
  margin-bottom: 3rem;
}

.mb6 {
  margin-bottom: 6rem;
}

              
            
!

JS

              
                var TEMPLATE = "<li class='Topic-item'><h3 class='Topic-item-title'></h3><p class='Topic-item-text'></p><a href='#' class='Btn Btn-action Btn-link'>Read more</a></li>";

//To search the contents.

$(function() {
  $("#button-search").on("click", function(e) {
    e.preventDefault();
    var searchValue = $("#search-input").val();
    var url = "https://en.wikipedia.org/w/api.php?action=opensearch&search="+ searchValue +"&pwpcontinue&format=json&callback=?"

    if ($.trim(searchValue) === "") {
      e.preventDefault();
    } else {
      search(url);
    }
  });
});

//To get the data

function search(url) {
  $.getJSON(url, handleResponse);
}

//Handler api

function handleResponse(response) {
  var topicsList = response[1];
  var descList = response[2];
  var urlList = response[3];
  background();

  $('#Topic-list').empty();

  topicsList.forEach(function (topicItem, index) {
    var nodo = $(TEMPLATE);
    updateTitle(nodo, topicItem);
    updateText(nodo, descList[index]);
    readMore(nodo, urlList[index]);

    $('#Topic-list').append(nodo);
  });
}

//To get the title

function updateTitle(nodo, data) {
  nodo.find(".Topic-item-title").html(data);
}

//To get the text

function updateText(nodo, text) {
  nodo.find(".Topic-item-text").html(text);
}

function readMore(nodo, url) {
  nodo.find(".Btn-link").attr("href", url);
}

function background() {
  $("body").addClass("is-clicked");
}

              
            
!
999px

Console