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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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="giphy">
      <a href="" target="blank">
        <img src="" alt="giphy">
  <p><img id="gif" src="" /></p>
 <div class="field">
    <input id="search" placeholder="Search for a gif">
    <button id ="btn" onclick="getGiphyData()">Search</button>
    <button id ="btn" onclick="getTrendingData()">Trending</button>
    <button id ="btn" onclick="getFavoritesData()">Favorites</button>
   <div id="tenGifs">
     <img id="gif~0" onclick="setFavorite(0)" />
     <img id="gif~1" onclick="setFavorite(1)"/>
     <img id="gif~2" onclick="setFavorite(2)"/>
     <img id="gif~3" onclick="setFavorite(3)"/>
     <img id="gif~4" onclick="setFavorite(4)"/>
     <img id="gif~5" onclick="setFavorite(5)"/>
     <img id="gif~6" onclick="setFavorite(6)"/>
     <img id="gif~7" onclick="setFavorite(7)"/>
     <img id="gif~8" onclick="setFavorite(8)"/>
     <img id="gif~9" onclick="setFavorite(9)"/>

    <p>Dakota Coleman Post Interview</p>



                * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;

body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-family: Arial;
  text-align: center;
  min-height: 100vh;
  min-width: 370px;
  background-color: #18181A;
  background-size: 200%;

h1 {
  padding: 20px 10px;
  letter-spacing: 0.2em;
  color: white;

field * {
  background: rgba(256, 256, 256, 0.3);
  color: white;

#btn {
  padding: 10px;
  border-radius: 2px;
  font-size: 16px;
  border: 2px solid white;

::placeholder {
  color: #f5f5f5;

#search {
  padding: 11px;
  width: 40%;
  min-width: 200px;
  max-width: 400px;
  border: 2px solid white ;

#search {
  outline: 0;
  color: #333;
  background: white;
  box-shadow: 0 0 1px 1px rgba(0, 0, 0, 0.3);

#btn {
  cursor: pointer;
  width: 90px;

#giphy {
  padding: 20px 0px 15px 0;

#giphy img {
  width: 500px;
  max-width: 800px;
  margin: auto;
  display: block;

giphy img.gif {
  width: 50%;
  max-width: 600px;
  box-shadow: 0 0 1px 1px rgba(256, 256, 256, 0.3);

footer {
  padding: 5px;
  font-size: 14px;
  color: white;

footer a {
  color: #333;
  text-decoration: none;
footer a:hover {
  color: white;
  text-decoration: underline;



                function getGiphyData() {
  //Get giphy data
  var searchTerm = document.querySelector("#search").value;
  var url =
    "" +

    .then(data => data.json())
    .then(res => {

      var arrayOfGifs =;
      var rand = Math.floor(Math.random() * arrayOfGifs.length);
      var firstItem = arrayOfGifs[rand];
      var giphyLink = firstItem.images.fixed_width.url;
      //makes giphy appear on page
      document.querySelector("#gif").setAttribute("src", giphyLink);
    .catch(error => console.log(error));

function getTrendingData() {
  var url =

    .then(data => data.json())
    .then(res => {
      var _outputHTML = ""
      var _tenGifs = document.getElementById("tenGifs");
    //  document.querySelector("#gif1").setAttribute("src", giphyLink);
      if ( < 10) return; // if not ten quit for now
      for(let i=0; i< 10 ;i++) {
        // add 10 gifs by appending new elements to the div #tenGifs
        var node = document.getElementById("gif~"+i);      

function setFavorite(imgId) {
  // save favorite for later